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

Extend automatic segmentation CLI to allow continuing annotation #858

Merged
merged 4 commits into from
Feb 11, 2025

Conversation

anwai98
Copy link
Contributor

@anwai98 anwai98 commented Feb 7, 2025

This PR closes #729, to (optionally) support continuing annotation / view automatic segmentations after automatic segmentation CLI process is completed. GTG from my side!

@anwai98 anwai98 linked an issue Feb 7, 2025 that may be closed by this pull request
micro_sam/automatic_segmentation.py Outdated Show resolved Hide resolved
micro_sam/automatic_segmentation.py Outdated Show resolved Hide resolved
micro_sam/automatic_segmentation.py Outdated Show resolved Hide resolved
micro_sam/automatic_segmentation.py Outdated Show resolved Hide resolved
micro_sam/sam_annotator/annotator_2d.py Outdated Show resolved Hide resolved
micro_sam/sam_annotator/annotator_2d.py Outdated Show resolved Hide resolved
@anwai98
Copy link
Contributor Author

anwai98 commented Feb 11, 2025

I realized that I was missing starting the GUI after returning the viewer, which is now taken care of now. Thank you for the suggestion. This should be GTG now!

Copy link
Contributor

@constantinpape constantinpape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good now! Have you checked that the instance segmentation is fetched from the viewer correctly though?

# We extract the segmentation in "committed_objects" layer, where the user either:
# a) Performed interactive segmentation / corrections and committed them, OR
# b) Did not do anything and closed the annotator, i.e. keeps the segmentations as it is.
instances = viewer.layers["committed_objects"].data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested once that this actually works? I am never sure about the actual state logic of napari.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tried this out, by removing labels, adding segmentations and closing the annotator. It works for all cases!

@constantinpape constantinpape merged commit d190b71 into dev Feb 11, 2025
3 checks passed
@constantinpape constantinpape deleted the extend-autoseg-cli branch February 11, 2025 08:10
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.

Extend automatic segmentation CLI to continue annotation
2 participants