Skip to main content

Watershed Segmentation

The Watershed tool performs watershed segmentation on target mask(s) for object separation. This technique separates touching or connected objects within a mask by treating the distance transform or grayscale image as a topographic surface.

Accessing the Tool

  1. Navigate to the Segmentation tab in the ribbon.
  2. Click Watershed in the Create Mask section.

How It Works

The watershed algorithm:

  1. Treats the grayscale image as a 3D topographic surface where intensity values represent elevation.
  2. Identifies local minima as starting points (catchment basins).
  3. Simulates flooding from these points.
  4. Where water from different basins meets, watershed lines are drawn.
  5. These lines define the boundaries between separate objects.

Parameters

Target Object(s)

  • Description: Select the target mask objects on which the operation will be applied
  • Options: Active Mask, Selected Masks, Visible Masks, All Masks

Connectivity Mode

Choose the voxel connectivity:

  • 6-connectivity: A voxel is considered connected only to its directly adjacent neighbors that share a face, excluding connections along edges or corners, resulting in up to 6 possible connections in a 3D grid (default)
  • 26-connectivity: A voxel is considered connected to all of its surrounding neighbors, including those along edges and corners (diagonal connections), resulting in a total of 26 possible connections in a 3D grid

Options

Level

  • Range: 0.0 to 999.0
  • Default: 1.0
  • Step: 0.001
  • Description: The level value controls the depth of the segmentation hierarchy
  • Effect: Higher values result in more aggressive separation

Create a mask with multiple labels as the output

  • Description: Select this option to create a multi-label mask for all disconnected regions. If this option is not selected, each disconnected region will be placed in a new mask
  • Type: Checkbox (unchecked by default)

Filter Objects (Optional)

Checkable group box to filter the watershed results (unchecked by default):

Minimum Object Size

  • Range: 1 to 999,999,999 voxels
  • Default: 2
  • Description: Specify the minimum size for an object, in voxels. Any object smaller than this size will be removed from the resulting mask

Remove Objects that Touch Boundaries

  • Options: No (default), Yes
  • Description: Select 'Yes' to remove any objects from the output mask that touch the boundaries. Select 'No' to skip the removal operation

Workflow

  1. Create an initial mask segmentation containing the objects you want to separate.
  2. Open the Watershed tool from the Segmentation tab.
  3. Select the Target object(s) (the mask(s) to process).
  4. Choose Connectivity mode (6-connectivity or 26-connectivity).
  5. Adjust the Level parameter to control separation sensitivity:
    • Lower values: More conservative separation
    • Higher values: More aggressive separation
  6. Optional: Enable Create a mask with multiple labels if you want one multi-label mask instead of separate mask objects.
  7. Optional: Enable Filter objects and configure:
    • Minimum object size to remove small fragments
    • Remove objects that touch boundaries
  8. Click Apply to run the watershed transform.
  9. Review the separated regions.

Use Cases

  • Cell Separation: Separate touching cells in microscopy images.
  • Particle Analysis: Divide connected particles in material science applications.
  • Bone Separation: Separate articulating bones in skeletal CT scans.
tip

For best results, apply a distance transform or gradient filter to the mask before watershed segmentation. This helps create more meaningful watershed basins.

Tips

  • Level Adjustment: Start with default (1.0) and adjust based on results:
    • Over-segmentation (too many splits): Decrease the level value
    • Under-segmentation (objects still connected): Increase the level value
  • Connectivity: Use 6-connectivity for more conservative separation, 26-connectivity for more inclusive neighborhood
  • Multi-label Output: Enable this option if you want all separated regions in one mask object for easier management
  • Filtering: Use "Minimum object size" to automatically remove noise and small fragments
  • Boundary Objects: Enable "Remove objects that touch boundaries" to exclude incomplete objects at volume edges
  • Preprocessing: Apply morphological operations (erosion, dilation) or smoothing before watershed for better results
  • Target Selection: Process multiple masks at once by selecting "Selected Masks" or "All Masks"

Technical Background

The morphological watershed transforms the image based on intensity gradients:

  1. Gradient Computation: Calculate intensity gradient magnitude.
  2. Marker Identification: Find local minima or use user-defined markers.
  3. Flooding Simulation: Grow regions from markers based on gradient values.
  4. Boundary Detection: Create separation boundaries where regions meet.

Comparison with Other Methods

MethodBest For
WatershedSeparating touching objects with intensity gradients.
Split MaskSeparating already-disconnected regions.
Region GrowIsolating single connected regions.

See Also