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

Delete multiple ROIs in GUI #718

Merged
merged 18 commits into from
Sep 13, 2023

Conversation

mrariden
Copy link
Collaborator

@mrariden mrariden commented May 24, 2023

Add functionality to GUI to allow 'batch' deletion of masks:

Current implementation is a button that starts batch deletion mode and masks can be selected/deselected until pressing the 'done' button. Once the 'done' button is pressed, the masks are removed from the relevant state variables and the mask is saved once.

Task list:

  • Add button(s) to start/stop batch deletion mode
  • Add function(s) to connect buttons
  • Allow region selection of multiple ROIs
  • Write tests?
  • Write documentation with images (maybe video?)
  • User testing on
    • Linux
    • Windows
    • Mac
  • Test with 3d image stack
  • Verify that manual tags are properly updated

Addresses:

@mrariden mrariden self-assigned this May 24, 2023
@codecov
Copy link

codecov bot commented May 24, 2023

Codecov Report

Merging #718 (a452c1b) into main (95f8d98) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #718   +/-   ##
=======================================
  Coverage   63.39%   63.39%           
=======================================
  Files          14       14           
  Lines        2964     2964           
=======================================
  Hits         1879     1879           
  Misses       1085     1085           

@mrariden
Copy link
Collaborator Author

Buttons now working. When button is clicked, the user can select masks (currently by individually clicking, but will implement region selection) and delete the selected masks with the done button.

Before:
image

Selection:
image

After deletion:
image

@mrariden mrariden added the enhancement New feature or request label May 26, 2023
@mrariden
Copy link
Collaborator Author

All test look good, just need final testing on Mac & Windows.

@mrariden mrariden marked this pull request as ready for review July 18, 2023 02:20
# Conflicts:
#	cellpose/gui/gui.py
#	cellpose/gui/guiparts.py
@mrariden
Copy link
Collaborator Author

@carsen-stringer resolved conflicts, integrated main, and ready for merge

@LeireIglesiasC
Copy link

Hi Michael,

I am quite new with cellpose, I downloaded it recently (last month) and I am now starting to use it for my analysis. The segmentation works for most cells that I want to select, however I have many masks over debris that I need to correct. I started deleting ROIs one by one, but it takes very long time (over an hour) since the masks automatically save each time in the seg.npy file. I saw this https://github.com/MouseLand/cellpose/issues/501 post where you linked this post to delete multiple ROIs in GUI.
I am not very familiar with cellpose, so I am not sure on what I should do to be able to see the "delete multiple ROIs" button that you show above.
Would you be able to help me with this? I show an example of how my GUI appears right now (with the uncorrected image, I still have to delete ROIs)
image

Thank you very much for your time.

Kind regards,

Leire Iglesias

@mrariden
Copy link
Collaborator Author

@LeireIglesiasC This feature is not currently merged into the main branch of cellpose, and that's why you don't see it. For the moment you can speed up deleting cells by disabling autosaving the _seg.npy file (File drop down -> Disable autosave checkbox). You will need to update your cellpose version since this feature was only added last week. You can do that with:

conda activate cellpose Activate your environment, assuming you called it cellpose
pip install cellpose==2.2.3

Or you can install this version of cellpose (the delete multiple feature) with these commands:

conda activate cellpose Activate your environment, assuming you called it cellpose
pip install git+https://github.com/mrariden/cellpose.git@delete_multiple_roi

If you do the latter please let us know your experience using the delete multiple feature!

@LeireIglesiasC
Copy link

Hi @mrariden , Thank you very much for your fast response. I tried both options you gave, the first one works perfectly! I updated the cellpose version and without the automatic saving the whole process is much faster.
I tried the second option just in case, but since it gave an error after running the command, so I have not used the delete multiple ROIs feature yet sorry.
image

Leire

@carsen-stringer carsen-stringer merged commit 2a07103 into MouseLand:main Sep 13, 2023
12 checks passed
@mrariden
Copy link
Collaborator Author

Ah this merge broke the disable autosave feature by replacing the save_sets_with_check() with the original save_sets()

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