Skip to main content

Volume To Mask

The Volume To Mask tool converts volume image data into mask objects. This is useful for creating masks from pre-segmented data, threshold-based volumes, or for direct data type conversion.

Accessing the Tool

  1. Navigate to the Image tab in the ribbon.
  2. Click Volume To Mask in the Convert section.

Conversion Modes

The tool offers two conversion modes:

Direct Copy Mode

Creates a mask by directly copying volume voxel values.

BehaviorDescription
8-bit dataCopied directly to the mask
Non-8-bit dataRescaled to 0–255 range before copying

Use case: Quick conversion when the volume already contains label-like data.

Segmentation Mode

Creates masks from pre-segmented volumes by extracting labels within a threshold range.

ParameterDescription
Lower thresholdMinimum intensity value to include
Upper thresholdMaximum intensity value to include
Multi-label maskCreate one mask with multiple labels or separate masks

Use case: Extracting specific labels from AI-segmented or atlas data.


Parameters

Target Objects

Select which volumes to convert:

  • Active volume object
  • Selected volume objects
  • All volume objects

Mode Selection

ModeDescription
Direct copyCopy volume values directly to mask
SegmentationExtract labels using threshold range

Segmentation Options

When using Segmentation mode:

ParameterDescription
Lower thresholdInclude voxels with values ≥ this threshold
Upper thresholdInclude voxels with values ≤ this threshold
Multi-label maskYes: Create single mask with all labels; No: Create separate mask per label

Workflow

Direct Copy

  1. Open the Volume To Mask tool.
  2. Select target volume(s).
  3. Set Mode to Direct copy.
  4. Click Apply.
  5. New mask objects are created in the Object Browser.

Extracting Labels from Segmentation

  1. Open the Volume To Mask tool.
  2. Select the pre-segmented volume.
  3. Set Mode to Segmentation.
  4. Set Lower threshold and Upper threshold to define the label range.
  5. Choose Multi-label mask:
    • Yes: All labels in one mask object
    • No: Separate mask for each unique label value
  6. Click Apply.

Use Cases

Converting AI Segmentation Results

AI segmentation tools (TotalSegmentator, nnU-Net, MONAI) often output volumes where each anatomical structure has a unique integer label:

  1. Import the segmentation result volume.
  2. Use Segmentation mode with threshold range covering all labels (e.g., 1–117).
  3. Create a multi-label mask for unified analysis, or separate masks for individual structures.

Creating Masks from Thresholded Data

For volumes already processed with threshold operations:

  1. Use Direct copy mode.
  2. Non-zero voxels become mask regions.
  3. Fast conversion without additional processing.

Extracting Specific Structures

To isolate specific labels from a multi-label volume:

  1. Set threshold range to the specific label value (e.g., lower=5, upper=5).
  2. Only voxels with that label are included.
  3. Creates a mask for just that structure.

Multi-Label vs. Separate Masks

OptionResultUse Case
Multi-label (Yes)One mask with multiple label valuesUnified segmentation analysis, export as single file
Separate masks (No)Individual mask per labelIndependent editing, per-structure analysis
info

Multi-label masks preserve the original label values from the volume. Separate masks each contain only their respective label as the foreground value.


Output

Created masks appear in the Object Browser under the Masks category:

  • Direct copy: Named based on source volume
  • Multi-label mask: Single mask with all extracted labels
  • Separate masks: Multiple masks, typically named with label indices

Data Type Considerations

Direct Copy Behavior

Source Data TypeMask Result
Unsigned 8-bitDirect copy (identical values)
Signed/Unsigned 16-bitRescaled to 0–255
32-bit integerRescaled to 0–255
Float/DoubleRescaled to 0–255
warning

Rescaling may lose precision for non-8-bit data. If exact values are important, use Segmentation mode with appropriate thresholds.

Segmentation Mode

Segmentation mode preserves label values within the mask (for multi-label) or uses the label value as the foreground (for separate masks).


Scripting

The Volume To Mask operations are available via the Python scripting API.

import ScriptingApi as api

app = api.Application()
volume_operations = app.get_volume_operations()

# Direct copy
mask_names = volume_operations.create_mask_by_direct_copying(["Volume1"])

# Segmentation - multi-label mask
mask_names = volume_operations.create_masks_by_segmentation(
["SegmentedVolume"],
1, # lower_threshold
255, # upper_threshold
True # create_multilabel_mask
)

# Segmentation - separate masks per label
mask_names = volume_operations.create_masks_by_segmentation(
["SegmentedVolume"],
1, # lower_threshold
117, # upper_threshold
False # create_multilabel_mask
)

See the VolumeOperations API Reference for details.


ToolDirectionDescription
Volume To MaskVolume → MaskConvert volume data to masks
Mask To SurfaceMask → SurfaceGenerate surface meshes from masks
ThresholdingVolume → MaskCreate masks using interactive thresholding