-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding widget for adding points layer #20
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Natali124 for your useful contribution!
I added minor ideas if you have time to implement them.
@magic_factory(call_button="Create a Points layer", auto_call=False) | ||
def read_csv_widget(filename = pathlib.Path('/path/to/csv/file.csv')): | ||
# Getting the current viewer | ||
viewer = napari.current_viewer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know this existed! Cool!
from magicgui import magic_factory | ||
import pathlib | ||
|
||
def rgb_to_xy(r, g, b): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this function name could go to _utils_channel_space.py
.
I also suggest to rename to something more specific that rgb_to_xy
with something more explicit rgb_to_maxwell_triangle
. You can also add a small docstring.
@@ -26,3 +29,6 @@ contributions: | |||
display_name: Diagnose Brainbow Image | |||
- command: napari-brainbow-diagnose.tooltip_pointer_widget | |||
display_name: Brainbow Tooltip | |||
- command: napari-brainbow-diagnose.read_csv_widget |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can reorder the widget list so your contribution comes first (It should be first step as it is a loading step)
points_layer = viewer.add_points(coordinates, name='points', face_color=colors, edge_color=colors, size=20, out_of_slice_display=True) | ||
|
||
# Add Maxwell coordinates | ||
df['x'], df['y'] = rgb_to_xy(df['red'], df['green'], df['blue']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe x
and y
can be renamed x-maxwell-triangle
, y-maxwell-triangle
to be explicit
Added code creates a points layer provided a csv file of coordinates and colors together with their features. Features x and y can then be used to plot Maxwell triangle using napari-clusters-plotter.