Skip to main content

Masking

The Masking tool applies a mask to a volume image, setting voxels outside the mask region to a specified intensity value. This allows you to isolate regions of interest and remove background or irrelevant anatomy from the volume data.

Accessing the Tool

  1. Navigate to the Image tab in the ribbon.
  2. Click Masking in the Operations section.

Concepts

TermDescription
Mask regionVoxels where the mask has non-zero values (inside the mask)
Outside regionVoxels where the mask is zero (background)
MaskingSetting voxels outside the mask to a specified value

Parameters

ParameterDescription
Intensity valueThe value assigned to voxels outside the mask region

Common intensity values:

  • 0: Black background (typical for CT display)
  • -1000: Air equivalent in Hounsfield Units (CT)
  • Minimum intensity: Match the volume's minimum value

How It Works

  1. The active mask defines the region of interest.
  2. Voxels where the mask has non-zero values are preserved.
  3. Voxels where the mask is zero are replaced with the specified intensity value.
Result(x,y,z)={Volume(x,y,z)if Mask(x,y,z)0IntensityValueif Mask(x,y,z)=0\text{Result}(x,y,z) = \begin{cases} \text{Volume}(x,y,z) & \text{if } \text{Mask}(x,y,z) \neq 0 \\ \text{IntensityValue} & \text{if } \text{Mask}(x,y,z) = 0 \end{cases}

Workflow

  1. Create or import a mask that defines the region of interest.
  2. Set the mask as the active mask in the Object Browser.
  3. Select the volume to be masked as the active volume.
  4. Open the Masking tool from the Image tab.
  5. Enter the desired intensity value for outside regions.
  6. Click Apply to perform the masking operation.

Use Cases

Isolating Anatomy

Focus on specific anatomical structures:

  1. Segment the structure of interest to create a mask.
  2. Apply the mask to the volume.
  3. Background anatomy is replaced with uniform intensity.
  4. Resulting volume shows only the masked region.

Removing Artifacts

Eliminate artifacts or unwanted features:

  1. Create a mask that excludes artifact regions.
  2. Apply the mask to replace artifacts with background intensity.
  3. Clean volume data for further analysis.

Creating ROI-Focused Datasets

Prepare data for specific analysis:

  1. Define ROI using segmentation tools.
  2. Mask the volume to isolate the ROI.
  3. Export or analyze only the relevant region.

Pre-Processing for AI/ML

Prepare training data:

  1. Mask irrelevant anatomy.
  2. Standardize background values.
  3. Reduce data complexity for model training.

Important Considerations

warning

Masking modifies the original volume data. Voxels outside the mask are permanently changed to the specified intensity value. Save your project or work on a copy if you need to preserve the original data.

Mask Alignment

The mask must be spatially aligned with the volume:

  • Same dimensions (voxel count)
  • Same spacing
  • Same origin

If mask and volume are misaligned, resample or register before masking.

Multi-Label Masks

For multi-label masks (masks with different label values):

  • All non-zero labels are treated as "inside" the mask
  • Only zero-valued voxels are replaced
  • To mask with a specific label, extract that label first

Intensity Value Selection

Data TypeSuggested ValueRationale
CT (HU)-1000Air equivalent, black in standard window
CT (positive only)0Minimum display value
MRI0Background
Unsigned data0Minimum possible value
tip

Choose an intensity value that provides good visual contrast with the region of interest and does not interfere with downstream analysis.


Scripting

The masking operation is available via the Python scripting API.

import ScriptingApi as api

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

# Apply mask to volume with intensity value 0
volume_operations.apply_mask_to_volume(
"Volume1", # Volume name
"Mask1", # Mask name
0.0 # Intensity value for outside regions
)

# Apply mask with -1000 HU (CT air)
volume_operations.apply_mask_to_volume("CT_Volume", "BodyMask", -1000.0)

See the VolumeOperations API Reference for details.


ToolPurpose
MaskingReplace voxels outside mask with constant value
CropRemove voxels outside a rectangular region
Volume To MaskCreate mask from volume intensity values