Skip to main content

Manual Mask Editing

Automated segmentation rarely produces perfect results. Manual editing tools allow you to correct errors, add missed regions, remove unwanted inclusions, and refine boundaries. This tutorial covers the essential editing techniques for producing publication-ready segmentations.

Estimated time: 25 minutes

Prerequisites:

Medical Disclaimer

Segmentation results should be reviewed and validated by qualified professionals. Manual corrections require anatomical knowledge appropriate to the application domain.


The Edit Mask Tool

The primary interface for manual editing is the Edit Mask tool.

Accessing Edit Mask

  1. Select a mask in the Object Browser.
  2. Navigate to Segmentation → Operations → Edit Mask.
  3. The Edit Mask panel opens with drawing tools and options.

Understanding the Interface

The Edit Mask panel contains:

  • ROI Tools — Selection tools for different drawing shapes
  • Edit Options — Draw/Erase mode and multi-layer settings
  • Brush Settings — Size and type configuration
  • Threshold Mode — Intensity-constrained drawing
  • LiveWire Parameters — Edge-snapping settings
  • Action Buttons — Clear mask and other operations

Drawing Tools

Brush Tool

Paint directly on masks using freehand strokes:

  1. Click the Brush button in the ROI tool buttons.
  2. Configure brush parameters:
    • Brush Size — Radius in pixels (1-1024 pixels)
    • Brush Type — Circle or Rectangle
  3. Paint in slice views:
    • Left-click + drag — Paint continuously
    • Release to stop painting
  4. The painted region is added to (Draw mode) or removed from (Erase mode) the mask

Keyboard shortcuts:

  • + key — Increase brush size
  • - key — Decrease brush size
  • Ctrl + O — Toggle between circular and rectangular brushes
Brush Technique

Use a large brush (50-200 pixels) for rough initial work, then switch to a smaller brush (5-20 pixels) for precise boundary refinement. Work in zoomed views for better accuracy.

Rectangle Tool

Draw rectangular regions:

  1. Click the Rectangle button in the ROI tools.
  2. Left-click and drag to define corners.
  3. Release to apply the rectangle.

Useful for quickly filling or clearing rectangular areas and for precise alignment-based corrections.

Circle Tool

Draw circular (cylindrical) regions:

  1. Click the Circle button in the ROI tools.
  2. Left-click and drag from the center outward to define the radius.
  3. Release to apply the circle.

Creates a circular region in 2D that extends as a cylinder through all slices when Multiple Layer is enabled.

Polygon Tool

Draw precise multi-point regions:

  1. Click the Polygon button in the ROI tools.
  2. Left-click to place vertices around the region.
  3. Middle-click to close and apply.

Ideal for following irregular boundaries with straight line segments. More precise than freehand tools.

Lasso Tool

Draw freehand contours:

  1. Click the Lasso button in the ROI tools.
  2. Left-click and drag to trace around the region (like drawing with a pencil).
  3. Release to close and apply.

Faster than polygon for organic shapes, but less precise. Good for quick approximate selections.

LiveWire Tool

Trace along high-contrast edges automatically:

  1. Click the LiveWire button in the ROI tools.
  2. Left-click to place anchor points along the boundary.
  3. The path automatically snaps to nearby edges based on intensity gradients.
  4. Middle-click to close and apply.

LiveWire Parameters:

  • Curvature Weight (0.0-1.0) — Higher values favor smoother curves
  • Edge Length Weight (0.0-1.0) — Higher values favor shorter paths

Useful on high-contrast edges where automatic edge detection works well.


Edit Modes

Draw Mode

Adds voxels to the mask:

  1. Ensure Draw mode is selected in Edit Options.
  2. Use any ROI tool to paint.
  3. Painted regions are added to the mask.

Erase Mode

Removes voxels from the mask:

  1. Select Erase mode in Edit Options.
  2. Use any ROI tool to paint.
  3. Painted regions are removed from the mask.

Quick toggle: Hold Shift while using any ROI tool to temporarily switch between Draw and Erase modes.

Multiple Layer Mode

Controls whether edits apply to one slice or all slices:

  • Enabled (checked) — Edits affect all slices (true 3D operation)
  • Disabled (unchecked) — Edits apply only to the current slice (2D slice-by-slice)

Use 2D mode for careful per-slice refinement. Use 3D mode for edits that logically span multiple slices.


Threshold-Constrained Drawing

Combine manual painting with intensity thresholding for selective editing:

  1. Enable the Threshold Mode checkbox in Edit Mask.
  2. Set Lower Grayvalue and Upper Grayvalue using the histogram.
  3. Paint in Draw mode.
  4. Only voxels within the threshold range are added to the mask; other voxels are unaffected.

Practical example:

  • Set threshold to bone values (200-3000 HU)
  • Paint broadly over a bone region in Draw mode
  • Only bone voxels are added; soft tissue and air are excluded

This is very useful for intensity-based refinement without strict geometric boundaries.


LiveWire Parameters

When using the LiveWire tool:

ParameterDescription
Curvature WeightControls how much the path prefers smooth curves (0.0-1.0, default varies). Higher values create smoother paths.
Edge Length WeightControls preference for shorter paths (0.0-1.0, default varies). Higher values favor paths along image edges.

Interpolate 3D

Fill gaps between segmented slices using interpolation:

  1. Segment several representative slices (e.g., every 5th slice).
  2. Navigate to Segmentation → Operations → Interpolate 3D.
  3. The algorithm fills intermediate slices by interpolating between segmented slices.
  4. Review and manually correct any errors.

This technique significantly reduces manual effort for large structures by requiring segmentation of only selected slices.


Boolean Operations

Combine multiple masks using set operations:

  1. Navigate to Segmentation → Operations → Boolean.

  2. Select two input masks.

  3. Choose the operation:

    OperationResult
    UnionCombines both masks (A ∪ B)
    IntersectionOnly overlapping regions (A ∩ B)
    DifferenceFirst mask minus second (A - B)
  4. Click Apply.

Common use cases:

  • Union — Combine separate structure masks into one
  • Intersection — Find overlap between two segmentations
  • Difference — Remove one structure from another

Practical Exercise: Refining a Bone Segmentation

Part 1: Assess the Initial Segmentation

  1. Create a threshold segmentation of bone (CT data).
  2. Scroll through slices to identify problems:
    • Holes in cortical bone
    • Included metal artifacts
    • Missing small bones

Part 2: Fill Internal Holes

  1. Navigate to Segmentation → Operations → Cavity Fill.
  2. Apply to close internal gaps in the bone.
  3. Review results—internal cavities should be filled.

Part 3: Remove Artifacts

  1. Open Edit Mask.
  2. Select the Brush tool with medium size.
  3. Set mode to Erase.
  4. Navigate to slices with metal artifacts.
  5. Carefully erase the artifact regions.
  6. Use small brush for edge refinement.

Part 4: Add Missing Regions

  1. Set mode to Draw.
  2. Enable Threshold mode with bone values.
  3. Paint over missing bone regions.
  4. Only voxels within threshold range are added.

Part 5: Smooth Boundaries

  1. Navigate to Segmentation → Operations → Smooth Mask.
  2. Select Median filter with radius 1.
  3. Apply to clean up jagged edges.

Editing Best Practices

Workflow Organization

  1. Save before editing — Create a backup of the original segmentation
  2. Work systematically — Edit slice-by-slice in one direction
  3. Use appropriate zoom — Zoom in for detailed work
  4. Check in 3D — Generate 3D preview to verify changes

Tool Selection

TaskRecommended Tool
Small correctionsBrush (small size)
Large region fillBrush (large) or Rectangle
Following edgesPolygon or LiveWire
Organic shapesLasso
Consistent structureThreshold-constrained brush

Quality Control

After editing:

  1. Scroll through all slices to verify completeness.
  2. Generate a 3D preview to check for surface artifacts.
  3. Compare with the original volume to verify anatomical accuracy.
  4. Use mask statistics to verify reasonable volume measurements.

Keyboard Shortcut Reference

ShortcutAction
+ / -Increase/decrease brush size
Ctrl + OToggle brush shape
ShiftToggle Draw/Erase while painting
Left-click + dragPaint/draw with current tool
Middle-clickClose polygon
Mouse wheelScroll slices
Ctrl + ZUndo (if available)

Troubleshooting

Edits not appearing

  • Verify the correct mask is selected
  • Check that the tool is in the correct mode (Draw vs Erase)
  • Ensure Multiple Layer setting matches your intent

Brush feels laggy

  • Reduce brush size
  • Disable Multiple Layer for faster 2D edits
  • Consider cropping the volume to reduce data size

Threshold mode not working

  • Verify threshold values are appropriate for the tissue
  • Check that the volume and mask are properly associated
  • Try a wider threshold range initially

Next Steps

With editing skills mastered, continue to:


See Also