I’m trying to remove some islands in a given size range (100 voxels to 1000 voxels, for example) using some python code similar to that in SegmentEditorIslandsEffect.py. I can see where vtkITKIslandMath() is used to do the actual work, but how do I get the islandsMath for the segment in question? Is it in the segmentations module logic? Right now, I get zero for GetNumberOfIslands(), which I’m assuming is because it’s not “connected” to the segmentation. (I think…?)
I could modify SegmentEditorIslandsEffect to do this, I suppose, and just reload that, but I’d like to try my logic just on the python console for starters.
You can easily get islands of a given size range by removing islands below 100 and below 1000 (Islands effect) and then computing the difference (Logical operators effect). You can run Segment editor effects from your scripts as shown here.