ShapeWorks icon indicating copy to clipboard operation
ShapeWorks copied to clipboard

Ability to set minimum size for the connected components in isolate()

Open iyerkrithika21 opened this issue 5 months ago • 0 comments

If the segmentation is too noisy the the isolate function fails as it is unable to handle the large number of connected components. ITK filter by default labels each non-zero unconnected pixel as a separate object, which is not efficient. We need to be able to specify the minimum object size required.

   # source: https://github.com/Bonelab/DECT_BoneAnalysis/blob/87ab9cad4afcc029085dc403ed212a7be39176ce/Segment_Edema.py#L110

   #Component labeling to remove small clusters less than 100 voxels in size:
    cc_filter = sitk.ConnectedComponentImageFilter()
    cl = cc_filter.Execute(edema_masked)

    cc_relabel = sitk.RelabelComponentImageFilter()
    cc_relabel.SetMinimumObjectSize(100)

iyerkrithika21 avatar Sep 12 '24 21:09 iyerkrithika21