Currently I’ve been working on automating a work flow in python that goes like the following:
- Load CT scans (as .tiffs)
- Create a segmentation and threshold to identify air in the scans
- Automate a mouse click in a known location and use the “Remove selected island” feature
- Apply the “Keep largest island” feature
- Calculate and report statistics
This process is functional and working currently, but requires my scripts to run with the slicer gui open (as opposed to running with “–no-splash --no-main-window”) because step 3 mimics a mouse click.
I’m realizing now that step 3 is actually always removing the largest island, which leads to my question.
Is there a “Remove largest island” functionality to accompany the “Keep largest island” function? (I haven’t been able to find one unfortunately).
If there isn’t, is there a way to programmatically sort the islands in python and then delete the biggest manually?
Thanks in advance for any help!