Skip to main content

Filter Regions

The Filter Regions tool removes mask regions based on their size. Use it to eliminate small noise fragments or filter out regions that don't meet size requirements for your analysis.

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

Accessing the Tool​

  1. Navigate to the Segmentation tab in the ribbon.
  2. Click Filter Regions 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).
26-connectivityVoxels connected to all surrounding neighbors including edges and corners (up to 26 connections).

Options​

Filter Mode (mutually exclusive radio buttons):

ModeDescription
Keep only the largest regionsKeep the specified number of largest regions by volume.
Remove regionsRemove regions smaller than the specified minimum size.

Mode-Specific Parameters:

ParameterAvailable WhenDescription
Number of largest regions"Keep only the largest regions" selectedSpecify how many of the largest regions to keep (1 to total regions).
Minimum region size (voxels)"Remove regions" selectedSet the minimum size in voxels. Regions smaller than this will be removed. Default: 512.

Workflow​

  1. Activate the mask you want to filter.
  2. Open the Filter Regions 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. Select the filtering operation:
    • Keep only the largest regions: Specify the number to keep.
    • Remove regions: Specify the minimum size threshold in voxels.
  6. Click Apply to perform the filtering operation on the active mask.

Use Cases​

Noise Removal​

Remove small isolated voxels from thresholding results:

  • Select "Remove regions"
  • Set minimum region size (e.g., 512 voxels)
  • Apply to clean up the segmentation

Isolating Primary Structure​

Keep only the main structure when multiple regions exist:

  • Select "Keep only the largest regions"
  • Set number to 1
  • Apply to remove all but the largest region

Keeping Multiple Large Structures​

Retain several main structures while removing noise:

  • Select "Keep only the largest regions"
  • Set the desired count (e.g., 3 for top 3 regions)
  • Apply to keep only those regions

Tips​

  • The tool displays the total region count in real-time based on connectivity mode.
  • The filter operation is only enabled when the mask contains more than one region.
  • For noise removal, start with a small minimum size (e.g., 100-500 voxels) and increase if needed.
  • Use 6-connectivity to identify more regions as separate (stricter criterion).
  • Use 26-connectivity if diagonal connections should keep regions together.
  • The "Keep only the largest regions" mode is sorted by volume, keeping the N largest.
tip

For datasets with many small noise regions, setting "Number of largest regions" to 1 is the fastest way to isolate the primary structure.

Technical Notes​

Region size is measured in voxels (not physical units). The number of voxels in each connected component determines its size for filtering purposes.

See Also​