Skip to main content

Refine Mask

The Refine Mask tool provides automated cleanup for the active mask by removing small disconnected components (regions/particles) and filling small internal cavities (voids/pores). Use the Update button to preview detected removals and fillings in 2D and 3D views before applying changes.

Accessing the Tool

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

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

Min. Region Size (voxels)

ParameterDescription
ValueThe minimum size (in voxels) for a connected region to be retained. Smaller regions (particles) will be removed. Set to 0 to disable region removal. Default: 10.
CountRead-only display showing the number of regions below the threshold that will be removed upon applying.

Preview: Regions to be removed are shown in yellow in the preview visualization.

Max. Cavity Size (voxels)

ParameterDescription
ValueThe maximum size (in voxels) of an internal cavity (enclosed hole) that will be filled. Larger cavities remain unfilled. Set to 0 to disable cavity filling. Default: 10.
CountRead-only display showing the number of cavities with sizes ≤ threshold that will be filled upon applying.

Preview: Cavities to be filled are shown in cyan in the preview visualization.

Workflow

  1. Activate the mask you want to refine.
  2. Open the Refine Mask tool from the Segmentation tab.
  3. Choose the Connectivity mode (6-connectivity or 26-connectivity).
  4. Set the Min. region size threshold (in voxels).
    • Regions smaller than this will be identified for removal.
  5. Set the Max. cavity size threshold (in voxels).
    • Internal cavities smaller than or equal to this will be identified for filling.
  6. Click Update to preview:
    • Regions to be removed appear in yellow.
    • Cavities to be filled appear in cyan.
    • The Count fields update to show how many will be affected.
  7. Adjust thresholds as needed and click Update again.
  8. Click Apply to perform the refinement operation on the active mask.
  9. The preview masks (yellow and cyan) are automatically removed after applying or closing the tool.

Use Cases

  • Post-Thresholding Cleanup: Remove noise particles and fill internal voids after basic thresholding.
  • Pre-Surface Generation: Prepare masks for clean surface mesh creation by removing artifacts and filling holes.
  • Quality Assurance: Preview and verify which small regions and cavities will be affected before applying changes.

Tips

  • Use Update for Preview: Always click Update first to see yellow (regions to remove) and cyan (cavities to fill) previews before applying.
  • Start Conservative: Begin with small threshold values (e.g., 10 voxels) and increase gradually while previewing.
  • Check the Counts: The read-only count fields show exactly how many regions/cavities will be affected.
  • Connectivity Matters: Try both 6-connectivity and 26-connectivity to see which better identifies your target regions/cavities.
  • Set to 0 to Disable: Set either threshold to 0 to disable that operation (e.g., only remove regions without filling cavities).
  • Preview in 2D and 3D: The preview shows in both slice views and 3D view for complete visualization.
tip

The Update button is key to this tool's workflow—it lets you experiment with different threshold values and see exactly what will be removed or filled before committing changes.

For more targeted control over specific operations:

  • Filter Regions — Advanced region filtering with multiple modes
  • Cavity Fill — Fill all internal cavities regardless of size
  • Split Mask — Separate regions into individual masks

See Also