Skip to main content

Split Mask

The Split Mask tool automatically identifies and separates disconnected regions within a mask into individual mask objects. Each isolated component becomes a separate mask, making it easier to analyze or process individual structures.

Accessing the Tool

  1. Navigate to the Segmentation tab in the ribbon.
  2. Click Split Mask in the Operations section.

Parameters

Active Mask Information

DisplayDescription
Connected regionsShows the total number of regions present in the active mask (read-only).

Connectivity Mode

OptionDescription
6-connectivityVoxels connected only to directly adjacent neighbors sharing a face (up to 6 connections). More regions identified.
26-connectivityVoxels connected to all surrounding neighbors including edges and corners (up to 26 connections). Fewer regions.

Options

OptionDescription
Separate only the largest regionsEnable to split only the N largest regions by volume. When disabled, all regions are split.
Number of largest regionsSpecify how many of the largest regions to separate (enabled when checkbox above is checked).
Create a mask with multiple labels as the outputWhen enabled, creates a single multi-label mask. When disabled, each region becomes a separate mask object.
Remove active maskIf enabled, the original active mask is removed after successful split operation.

Workflow

  1. Activate the mask you want to split.
  2. Open the Split Mask tool from the Segmentation tab.
  3. View the Connected regions count displayed for the active mask.
  4. Choose the Connectivity mode (6-connectivity or 26-connectivity).
    • Changing connectivity updates the region count automatically.
  5. Configure Options:
    • Optionally enable "Separate only the largest regions" and specify the count.
    • Choose output format: individual masks or multi-label mask.
    • Optionally enable "Remove active mask".
  6. Click Apply to perform the split operation.

How It Works

The algorithm performs connected component labeling:

  1. Scans the mask for labeled voxels.
  2. Groups connected voxels based on the connectivity setting.
  3. Assigns a unique identifier to each connected component.
  4. Creates output masks or labels for each component.

Use Cases

  • Object Counting: Separate and count individual objects in a segmentation.
  • Component Analysis: Analyze each region independently.
  • Quality Control: Identify and review isolated fragments.
  • Preprocessing: Prepare for further processing of individual structures.

Tips

  • Use lower connectivity (6-connected) if you want to identify more separate regions.
  • Use higher connectivity (26-connected) if thin connections should keep regions together.
  • Combine with Filter Regions to remove small fragments before splitting.
note

If the mask contains thousands of small disconnected regions, the split operation may create many mask objects. Consider using Filter Regions first to remove noise.

Scripting

Split operations are available via the Python scripting API:

import ScriptingApi as api

app = api.Application()
mask_operations = app.get_mask_operations()

# Split mask into separate regions
result_masks = mask_operations.split_mask(
"Combined_Mask", # mask name
2, # number of largest regions
False # create a multi-label mask as a result
)

print(f"Created {len(result_masks)} separate masks")

See the MaskOperations API Reference for details.

See Also