Skip to main content

Threshold Segmentation

The Threshold tool segments voxels from volume data based on their grayscale intensity values. Voxels within the specified range are included in the mask; voxels outside the range are excluded. This is one of the most fundamental and widely used segmentation techniques.

A lower and upper threshold marked on the intensity histogram, and on the right the voxels whose intensity falls inside that range, highlighted as the mask

Accessing the Tool​

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

Parameters​

Presets​

A preset stores a lower and an upper threshold. Selecting one applies both immediately, and each entry shows a thumbnail rendered from the current volume so the list can be compared at a glance.

These presets are supplied by default:

PresetLowerUpper
Bone22610000
Muscle-5135
Fat-205-51
Skin-718-177
Tooth120010000

The five supplied threshold presets drawn as ranges on the Hounsfield scale: Skin, Fat, Muscle, Bone and Tooth, the last two running on to 10000

The preset tool button opens the preset operations menu:

EntryFunction
Save a New Preset...Store the current thresholds under a new name
Save Settings to Selected PresetOverwrite the selected preset with the current thresholds
Save Presets As...Write the whole list to a file
Load Presets...Replace the list with the presets from a file
Remove Selected PresetDelete the selected preset
Restore to Default PresetsDiscard the list and bring back the presets above

The list is stored per user, so it is kept across projects and sessions.

The default presets assume Hounsfield units

The supplied values are calibrated for CT data in Hounsfield units, where air is about -1000 and water is 0. They are meaningless on an industrial CT reconstruction or any other volume with an uncalibrated gray value scale. On such data, set the thresholds from the histogram or the Profile line, then save your own preset.

Threshold Adjustment​

The histogram widget displays the intensity distribution of the volume data with interactive threshold controls:

ControlDescription
Lower ThresholdMinimum intensity value to include.
Upper ThresholdMaximum intensity value to include.
HistogramVisual representation of intensity distribution.

Drag the thresholds on the histogram or enter numeric values directly to adjust the range. The preview updates in real-time in the slice views.

The distribution is drawn in the Interactive Histogram Chart, with the two thresholds shown as lines on it. Drag a line to move that threshold directly on the distribution. Drag the shaded area between the two lines to move the whole range without changing its width. Scroll to zoom into a narrow band of gray values, and right-click to reach the display options. This histogram is a preview for setting the threshold, not measurement data, so the chart's CSV export is not offered here; copying it to the clipboard or saving it as a picture still is.

Profile line​

The Profile line group helps identify appropriate threshold values by analyzing intensity values along a path:

  1. Expand the Profile line group.
  2. Draw a line across the region of interest in a slice view.
  3. The profile chart displays intensity values along the line.
  4. Use this information to identify appropriate threshold boundaries.

Options​

The Options group cleans up the result while it is created, which saves a separate pass with the region tools afterwards:

OptionDescriptionDefault
Fill cavitiesFill internal gaps enclosed by the thresholded region, so the mask represents a solid bodyOff
Filter regionsEnable region filtering, then choose one of the two modes belowOff
Keep the largest regionRetain only the largest connected region by volumeSelected
Remove regionsRemove every region smaller than Minimum region size (voxels)
Minimum region size (voxels)Size limit used by Remove regions (1 to 9,999,999)2

A mask with four connected regions; Split Mask makes one mask per region, Filter Regions removes the regions below the size limit, Refine Mask removes small regions and fills small cavities

A mask with an enclosed cavity and an opening to the outside: after Cavity Fill the enclosed cavity is filled and the opening is left as it is

Result​

OptionDescription
Target maskSelect an existing mask, or leave <New mask object> to create one.
ReplaceReplace the content of the selected mask with the thresholded result (default).
MergeAdd the thresholded region to the existing content of the selected mask.

Workflow​

  1. Open the Threshold tool from the Segmentation tab.
  2. Optionally select a Preset matching your target material.
  3. Adjust the lower and upper threshold using the histogram, or type exact values.
  4. Observe the preview overlay in the slice views.
  5. Use the Profile line group if you need to analyze a specific intensity transition.
  6. Set Fill cavities and Filter regions in Options if the result needs cleaning up.
  7. Select the target mask and the Replace or Merge mode.
  8. Click Apply to create or update the mask.

Technical Background​

Thresholding is a pixel-wise classification method that assigns each voxel to the foreground (inside the mask) or background based solely on its intensity value:

M(x,y,z)={1if Tlower≤I(x,y,z)≤Tupper0otherwiseM(x,y,z) = \begin{cases} 1 & \text{if } T_{lower} \leq I(x,y,z) \leq T_{upper} \\ 0 & \text{otherwise} \end{cases}

Where:

  • MM is the output mask
  • II is the input volume intensity
  • TlowerT_{lower} and TupperT_{upper} are the threshold bounds
note

Thresholding works well when the target structure has distinct intensity values from surrounding tissues. For structures with overlapping intensities, consider using region growing or more advanced segmentation methods.

Tips​

  • Start with a wide threshold range and narrow it gradually.
  • Use the histogram to identify peaks corresponding to different tissue types.
  • Combine thresholding with region growing to isolate connected objects.
  • For noisy data, consider smoothing the volume before thresholding.

Scripting​

Threshold segmentation is available via the Python scripting API:

import ScriptingApi as api

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

threshold_params = api.ThresholdParams()
threshold_params.lower_threshold = 200
threshold_params.upper_threshold = 3000
threshold_params.filter_regions = True
threshold_params.remove_regions = True
threshold_params.min_region_size = 27
threshold_params.keep_largest = False

# Apply threshold segmentation
result_mask = mask_operations.threshold('CT_Volume', threshold_params)

See the MaskOperations API Reference for details.

See Also​