Skip to content

Add widget to generate shape layer and colour by features - #201

Merged
jni merged 43 commits into
jni:mainfrom
jamesyan-git:colour-features
Oct 12, 2023
Merged

Add widget to generate shape layer and colour by features#201
jni merged 43 commits into
jni:mainfrom
jamesyan-git:colour-features

Conversation

@jamesyan-git

Copy link
Copy Markdown
Contributor

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

Comment thread src/skan/napari_skan.py Outdated
Comment on lines +21 to +25
return Shapes(all_paths,
shape_type='path',
edge_colormap='tab10',
metadata={"skeleton": skeleton}
)

Copy link
Copy Markdown
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
Copy Markdown
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?

@jni jni left a comment

Copy link
Copy Markdown
Owner

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).

Comment thread setup.cfg
testing =
coverage
hypothesis
napari[pyqt5]!=0.4.18

Copy link
Copy Markdown
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! 😅

Comment thread src/skan/napari.yaml Outdated
- command: skan.skeletonize_labels
display_name: Skeletonize labels...
- command: skan.skeletonize
display_name: Skeleton Widg...

Copy link
Copy Markdown
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?

Comment thread 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(

Copy link
Copy Markdown
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?

Comment thread src/skan/napari_skan.py Outdated
return all_paths, layer_kwargs, 'shapes'


def populate_feature_choices(color_by_feature_widget):

Copy link
Copy Markdown
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 _)

Comment thread setup.cfg Outdated
include_package_data = True
install_requires =
imageio>=2.10.1
magicgui @ git+https://git@github.com/pyapp-kit/magicgui.git

Copy link
Copy Markdown
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
@jni

jni commented Oct 12, 2023

Copy link
Copy Markdown
Owner

🥳

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