Add widget to generate shape layer and colour by features - #201
Conversation
| return Shapes(all_paths, | ||
| shape_type='path', | ||
| edge_colormap='tab10', | ||
| metadata={"skeleton": skeleton} | ||
| ) |
There was a problem hiding this comment.
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.
@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
jni
left a comment
There was a problem hiding this comment.
@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).
| testing = | ||
| coverage | ||
| hypothesis | ||
| napari[pyqt5]!=0.4.18 |
There was a problem hiding this comment.
Can you add a comment here about why we blocked 0.4.18? If you remember, I've totally forgotten! 😅
| - command: skan.skeletonize_labels | ||
| display_name: Skeletonize labels... | ||
| - command: skan.skeletonize | ||
| display_name: Skeleton Widg... |
|
|
||
| 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.
Let's rename this something more meaningful, say, labels_to_skeleton_shapes?
| return all_paths, layer_kwargs, 'shapes' | ||
|
|
||
|
|
||
| def populate_feature_choices(color_by_feature_widget): |
There was a problem hiding this comment.
Probably should be private? (ie prefixed with _)
| include_package_data = True | ||
| install_requires = | ||
| imageio>=2.10.1 | ||
| magicgui @ git+https://git@github.com/pyapp-kit/magicgui.git |
|
🥳 |
Making a widget to allow users to select layer to skeletonise and colour by features