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
- Navigate to the Segmentation tab in the ribbon.
- Click Watershed in the Create Mask section.
How It Works
The watershed algorithm:
- Treats the grayscale image as a 3D topographic surface where intensity values represent elevation.
- Identifies local minima as starting points (catchment basins).
- Simulates flooding from these points.
- Where water from different basins meets, watershed lines are drawn.
- 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
- Create an initial mask segmentation containing the objects you want to separate.
- Open the Watershed tool from the Segmentation tab.
- Select the Target object(s) (the mask(s) to process).
- Choose Connectivity mode (6-connectivity or 26-connectivity).
- Adjust the Level parameter to control separation sensitivity:
- Lower values: More conservative separation
- Higher values: More aggressive separation
- Optional: Enable Create a mask with multiple labels if you want one multi-label mask instead of separate mask objects.
- Optional: Enable Filter objects and configure:
- Minimum object size to remove small fragments
- Remove objects that touch boundaries
- Click Apply to run the watershed transform.
- 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:
- Gradient Computation: Calculate intensity gradient magnitude.
- Marker Identification: Find local minima or use user-defined markers.
- Flooding Simulation: Grow regions from markers based on gradient values.
- Boundary Detection: Create separation boundaries where regions meet.
Comparison with Other Methods
| Method | Best For |
|---|---|
| Watershed | Separating touching objects with intensity gradients. |
| Split Mask | Separating already-disconnected regions. |
| Region Grow | Isolating single connected regions. |
See Also
- Split Mask — Separate disconnected regions.
- Region Grow — Extract connected regions.
- Filter Regions — Remove small regions.
- Segmentation Tab Overview — Overview of all segmentation tools.