-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add widget to generate shape layer and colour by features #201
Conversation
src/skan/napari_skan.py
Outdated
return Shapes(all_paths, | ||
shape_type='path', | ||
edge_colormap='tab10', | ||
metadata={"skeleton": skeleton} | ||
) |
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.
This should instead be a LayerDataTuple so we don't need to depend on napari.
return (
all_paths,
{'shape_type': 'path', 'edge_colormap': 'tab10', 'metadata': {'skeleton': skeleton}},
'shapes',
)
I also think you should analyze the skeleton in this function and add the features to the layer — the next widget is way too complicated. This way we don't need to depend on magicgui either!
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.
@jni Updated to LayerDataTuple
and now computing the summary at time of skeletonization.
I think we still need some logic in case the user selects a shape layer without a skeleton feature, but I've tried to simplify.
The only way we can get rid of magicgui is if definitely knew the column names. We COULD hard code this but there is a parameter summarize
that returns an additional column.
I also removed the get_features
button but now I'm having trouble populating the features combo on widget initialization. Maybe we can catch up this evening?
…into colour-features
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.
@jamesyan-git Just picking this back up. I think the tests will fail until we copy the relevant GH Actions setup (setup-qt-libs etc) from e.g. cookiecutter-napari-plugin (ie setup-qt-libs and headless-gui).
@@ -71,8 +72,10 @@ all = | |||
testing = | |||
coverage | |||
hypothesis | |||
napari[pyqt5]!=0.4.18 |
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.
Can you add a comment here about why we blocked 0.4.18? If you remember, I've totally forgotten! 😅
src/skan/napari.yaml
Outdated
- command: skan.skeletonize_labels | ||
display_name: Skeletonize labels... | ||
- command: skan.skeletonize | ||
display_name: Skeleton Widg... |
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.
Can you update the names here?
src/skan/napari_skan.py
Outdated
|
||
|
||
def skeletonize_labels(labels: "napari.types.LabelsData", method: SkeletonizeMethod) -> "napari.types.LabelsData": | ||
"""Takes a labels layer and a skimage skeletonize method and generates a skeleton representation | ||
def get_skeleton( |
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.
Let's rename this something more meaningful, say, labels_to_skeleton_shapes
?
src/skan/napari_skan.py
Outdated
return all_paths, layer_kwargs, 'shapes' | ||
|
||
|
||
def populate_feature_choices(color_by_feature_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.
Probably should be private? (ie prefixed with _
)
setup.cfg
Outdated
@@ -48,6 +48,7 @@ python_requires = >=3.8 | |||
include_package_data = True | |||
install_requires = | |||
imageio>=2.10.1 | |||
magicgui @ git+https://[email protected]/pyapp-kit/magicgui.git |
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.
Oh this can now be magicgui>=0.7.3
🥳 |
Making a widget to allow users to select layer to skeletonise and colour by features