Skip to content
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

Merged
merged 43 commits into from
Oct 12, 2023

Conversation

jamesyan-git
Copy link
Contributor

Making a widget to allow users to select layer to skeletonise and colour by features

Comment on lines 21 to 25
return Shapes(all_paths,
shape_type='path',
edge_colormap='tab10',
metadata={"skeleton": skeleton}
)
Copy link
Owner

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!

Copy link
Contributor Author

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?

Copy link
Owner

@jni jni left a 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
Copy link
Owner

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! 😅

- command: skan.skeletonize_labels
display_name: Skeletonize labels...
- command: skan.skeletonize
display_name: Skeleton Widg...
Copy link
Owner

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?



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(
Copy link
Owner

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?

return all_paths, layer_kwargs, 'shapes'


def populate_feature_choices(color_by_feature_widget):
Copy link
Owner

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
Copy link
Owner

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

@jamesyan-git jamesyan-git marked this pull request as ready for review October 12, 2023 01:16
@jni jni merged commit b61b24a into jni:main Oct 12, 2023
11 checks passed
@jni
Copy link
Owner

jni commented Oct 12, 2023

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants