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

Export ROIs directly to ImageJ #643

Merged
merged 8 commits into from
May 19, 2023
Merged

Conversation

mrariden
Copy link
Collaborator

Allows exporting outlines to .zip archive of .roi files using roifile ImageJ as mention in #581. This introduces a new dependency, roifile.

  • Left the "Save Outlines" functionality as it was both in the GUI and in the command line args
  • Added --save_rois command line flag
  • Added GUI button similar to existing "save outlines" functionality

Did not update docs (how/should I do this?)

@carsen-stringer
Copy link
Member

Thanks you so much, this looks great and super useful! I just need to test it, will get to it soon. The documentation can be added here: https://github.com/MouseLand/cellpose/blob/main/docs/outputs.rst

@mrariden mrariden self-assigned this May 6, 2023
@mrariden mrariden added the enhancement New feature or request label May 6, 2023
@mrariden
Copy link
Collaborator Author

Cellpose segmentation:
image

Save the ROIs:
Going into CP GUI -> save outlines as .zip

Use the ROIs in FIJI/ImageJ:

  1. Open image
  2. Import ROIs using File -> open. Recent versions will autodetect that the file is an roi archive
  3. Click 'show all' to display the rois on the image.
    image

Note that the roifile library appends rois to existing archives. So, if the user removes rois after saving the removed rois will still be there when the user saves again. I circumvented this by deleting the file before writing, but this may not be ideal for images with many ROIs.

I added ctrl+R shortcut for the function in the GUI, and updated relevant docs.

@codecov-commenter
Copy link

codecov-commenter commented May 10, 2023

Codecov Report

Merging #643 (c8fdf9a) into main (b709064) will decrease coverage by 0.09%.
The diff coverage is 25.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #643      +/-   ##
==========================================
- Coverage   37.40%   37.31%   -0.09%     
==========================================
  Files          20       20              
  Lines        5355     5378      +23     
==========================================
+ Hits         2003     2007       +4     
- Misses       3352     3371      +19     
Impacted Files Coverage Δ
cellpose/gui/gui.py 7.53% <0.00%> (-0.01%) ⬇️
cellpose/gui/guiparts.py 12.69% <ø> (ø)
cellpose/gui/menus.py 7.96% <0.00%> (-0.37%) ⬇️
cellpose/io.py 62.43% <25.00%> (-0.85%) ⬇️
cellpose/gui/io.py 8.46% <28.57%> (+0.12%) ⬆️
cellpose/__main__.py 64.47% <50.00%> (-0.20%) ⬇️
cellpose/cli.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@mrariden
Copy link
Collaborator Author

@carsen-stringer Can you review and potential merge?

@carsen-stringer
Copy link
Member

thanks this looks great!

@carsen-stringer carsen-stringer merged commit 26263c6 into MouseLand:main May 19, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants