Automatically split segmentation islands connected by a narrow path

Screenshot 2023-08-02 at 16.35.26

Hi there, I have a simple question.

I am using the segment islands tool to separate tumours that are not touching each other into unique segments. How do I separate tumours that are touching each other i.e. have narrow connections in the segmentation? I need a method that does not involve the scissors tool as this takes too long.

I have hundreds of MRI images with similar labelmaps. I cannot use the scissors tool manually on them one by one this would take days, and would also drive me insane.

Cheers,

Ulvi

Maybe margin down and then margin up the tumor segment, although you may lose some accuracy of the segment surface

For bones, I find Smoothing effect → Opening very helpful. If you threshold bones, try a conservative not overaggressive setting that leaves the connections minimal.

Thank you for your responses guys.

Unfortunately, large variations in the size of the tumours in the imaged mice means that the calibration of the margin and smoothing tool are impossible to fit all cases.

Surely there is a 3D equivalent of the binary watershed algorithm used in FIJI (ImageJ)?

Cheers,

Ulvi

Watershed method is available in Slicer, too, along with many others. We usually want to segment identified structures, each marked with some seeds, therefore both “Watershed” (in SegmentEditorExtraEffects extension) and “Grow from seeds” (in Slicer core) effects require some input segments. These input segments can be very easily generated automatically (e.g., using Thresholding or Margin effect, followed by Islands / Split islands to segments).

Alternatively, you can run classic markerless watershed using ITK: compute distance map from the segmentation, partition it using watershed filter, then apply that partitioning to the original segmentation. You can use the application GUI for this (see the steps below), but you can of course fully automate it, to perform all the steps with a short Python script.

Classic watershed partitioning of a segment:

  • Export segment to labelmap (by right-clicking on the segmentation in Data module)
  • Compute distance map from segment (Simple Filters module, SignedMaurerDistanceMapImageFilter)
  • Compute watershed regions (Simple Filters module, MorphologicalWatershedImageFilter; Input Volume is the computed distance map; Level is a positive distance value, the optimal value depends on the thickness of the connecting path and size of the structure, you can start with 10 and increase if there are too many segments, decrease it if the structures are not separated; for output, choose Create new LabelMapVolume, scroll down to see this option).
  • Import the watershed results into the segmentation (drag-and-drop the labelmap output of the watershed filter into the segmentation; or use Import section in Segmentations module)
  • Use “Logical operators” effect to intersect the each imported segment from watershed with the original segmentation

If you confirmed that this works well for your data using the GUI, you can fully automate this process using Python scripting. Simple Filters code shows up in the Python console (or you can use ITKPython). Other operations are described in the script repository. If you have trouble figuring out how to automate a certain step and Bing chat/ChatGPT does not help either then you can ask us here.

If you find this useful then we may consider adding this watershed-based splitting method as a Segment Editor effect (you can submit a feature request for it).