Skip to main content

Mirror to Plane

The Mirror to Plane tool performs a geometric reflection of surfaces, masks, or both across a user-defined plane. This operation updates the selected objects in-place, transforming the geometry to its mirrored status. To ensure data integrity for segmentation masks that may reflect outside the original volume boundaries, the tool offers an optional automatic padding mechanism.

Overview

Plane mirroring is a fundamental geometric transformation defined by a reflection across a plane in 3D Euclidean space. Mathematically, for any point PP and a plane defined by a point P0P_0 and a unit normal vector n\mathbf{n}, the reflected point PP' is given by the Householder transformation:

P=P2((PP0)n)nP' = P - 2 ((P - P_0) \cdot \mathbf{n}) \mathbf{n}

Distances are preserved and orientation is reversed.

Key Applications

  • Symmetry Restoration & Analysis: Reflecting healthy anatomy to reconstruct defective contralateral sides in craniomaxillofacial (CMF) surgery.
  • Implant Design: Generating contralateral templates for patient-specific implants.
  • Data Augmentation: Expanding training datasets for deep learning by generating mirrored variations of segmented structures a.
  • Geometric Validation: Assessing asymmetry by overlaying mirrored geometry onto original anatomy.

Accessing the Tool

  1. Navigate to the Surface ribbon tab.
  2. Locate the Edit section.
  3. Click the Additional dropdown menu.
  4. Select Mirror to Plane.

Target Object(s) Specification

The tool supports batch processing of surfaces and masks. Select the desired scope from the Target object(s) dropdown:

Target ScopeDescription
Active SurfaceMirror only the active surface.
Selected SurfacesMirror all selected surfaces in the Data Manager.
Visible SurfacesMirror all surfaces visible in the 3D view.
All SurfacesMirror all surfaces in the project.
Active MaskMirror only the active mask.
Selected MasksMirror all selected masks in the Scene Object Tree.
Visible MasksMirror all masks visible in the 3D view.
All MasksMirror all masks in the project.
Visible Masks and Visible SurfacesMirror all visible masks and visible surfaces.
All Masks and All SurfacesMirror all masks and all surfaces.
In-place operation

The tool does not create copies. Duplicate objects first if you need both original and mirrored geometry.

note

This tool mirrors entire objects. It does not support region-of-interest selection.

Plane Configuration

The reflection plane is defined by an Origin (P0P_0) and a Normal (n\mathbf{n}).

Interactive Visualization

Enable Show plane to visualize the reflection plane in the 3D viewport. The plane widget can be manipulated interactively to fine-tune the reflection axis relative to the anatomical structures.

Plane Parameters

  • Origin (mm): Specifies a point on the plane (x,y,zx, y, z) with up to 9 decimal places precision. This determines the position of the plane but not its orientation.
  • Normal: Specifies the vector perpendicular to the plane (nx,ny,nzn_x, n_y, n_z) with up to 9 decimal places precision. This determines the orientation of the reflection.
note

The input normal vector is automatically normalized to unit length (n=1||\mathbf{n}|| = 1) during the operation. A zero vector is invalid and will prevent execution.

warning

The plane normal must not be zero. If all normal components are zero, the operation is aborted.

Quick Alignment Buttons

Quick alignment buttons set the plane normal to standard anatomical axes:

  • X-axis (1,0,01, 0, 0): Corresponds to the Sagittal plane. Reflects Left \leftrightarrow Right.
  • Y-axis (0,1,00, 1, 0): Corresponds to the Coronal plane. Reflects Anterior \leftrightarrow Posterior.
  • Z-axis (0,0,10, 0, 1): Corresponds to the Axial plane. Reflects Superior \leftrightarrow Inferior.

These buttons set the normal direction while preserving the current origin position.

Reset

The Reset button recalculates the plane placement based on the bounding box of the current target objects. If no valid target bounds are available, it falls back to the active surface or active mask.

Output Behavior

  • Surfaces are updated in place. The mirror operation reflects vertices and then recomputes triangle orientation and normals.
  • Masks are updated in place. Reflected voxels are written into the same mask objects.
warning

Mask mirroring requires valid 3D mask previews. If a mask has no preview surface, the operation stops and prompts you to generate previews.

Other Options

Padding Volume (Optional)

When mirroring objects that extend beyond current volume bounds, enable Pad images to cover mirrored region in the Other options section:

OptionDescription
Pad images to cover mirrored regionPads the project's image data so mirrored geometry remains inside volume bounds

Padding is calculated from the mirrored bounds of the selected surfaces and mask previews. The active volume provides the spacing for the padding calculation, and all volumes/masks in the project are padded together.

tip

Enable padding when mirroring masks close to the volume boundary to avoid clipped voxels.

Best Practice

Always enable padding when mirroring masks that are not strictly centered or when reflecting across a plane far from the volume center. This ensures the integrity of the segmentation is preserved.

How the Mirror Operation Works

Mathematical Foundation

The mirror operation uses Householder reflection to transform each point:

p=p2((po)n)n\mathbf{p}' = \mathbf{p} - 2((\mathbf{p} - \mathbf{o}) \cdot \mathbf{n})\mathbf{n}

Where:

  • p\mathbf{p} is the original point position
  • p\mathbf{p}' is the reflected position
  • o\mathbf{o} is the plane origin
  • n\mathbf{n} is the unit normal vector
  • \cdot represents the dot product

Surface Processing

For surface meshes:

  1. Vertex reflection: Each vertex is reflected using the Householder formula
  2. Cell winding reversal: Triangle winding order is reversed to maintain correct orientation
  3. Normal recomputation: Surface normals are recalculated for proper rendering and shading

This preserves the geometric properties while reversing the orientation.

Mask Processing

For segmentation masks:

  1. Voxel transformation: Each voxel is reflected to its mirrored position using nearest-neighbor interpolation
  2. Label preservation: Nearest-neighbor interpolation preserves discrete label values
  3. Volume expansion: If padding is enabled, the volume is expanded before reflection
  4. Preview regeneration: 3D mask previews are invalidated and regenerated after the operation

Practical Applications

Bilateral Reconstruction (Surface or Mask)

  1. Duplicate the source object.
  2. Set Target object(s) to Active Surface or Active Mask (with the duplicate active).
  3. Click X-axis for a sagittal reflection.
  4. Set Origin X at the anatomical midline.
  5. Enable Show plane to confirm alignment.
  6. If mirroring a mask, enable Pad images to cover mirrored region.
  7. Click Apply.

Creating Contralateral Implants

Use case: Design a left implant from a right-side template.

  1. Import or create the right-side implant surface
  2. Set normal to (1, 0, 0) for sagittal reflection
  3. Position the origin at the anatomical midline
  4. Mirror the surface
  5. The result is a geometrically accurate left-side implant

Symmetry Validation

Use case: Assess anatomical symmetry by overlaying original and mirrored structures.

  1. Create a surface of one side
  2. Mirror it across the anatomical midline
  3. Use color coding or transparency to compare original and mirrored sides
  4. Measure distances to quantify asymmetries

Mask Augmentation

Use case: Expand a segmentation dataset by creating mirrored versions.

  1. Select the mask to mirror
  2. Configure the appropriate reflection plane
  3. Enable padding if needed
  4. Apply the mirror
  5. The mask now contains both original and reflected regions

Technical Considerations

Surface Orientation

Mirrored surfaces have their triangle winding order reversed automatically. This ensures:

  • Correct surface normals (pointing outward)
  • Proper rendering (front face culling works correctly)
  • Accurate volume calculations in subsequent operations

You do not need to manually fix normals after mirroring.

Mask Padding Requirements

Masks are constrained to the volume extents. If a mirrored mask would extend beyond the current volume:

  • Without padding: Voxels outside the volume are discarded (data loss)
  • With padding: The volume is automatically expanded to accommodate all data
caution

Always check volume dimensions before mirroring masks without padding enabled.

Volume Expansion Direction

When padding is enabled, the volume expands in the direction needed to contain the mirrored geometry. The expansion is calculated based on:

  • The bounding boxes of surfaces/masks to be mirrored
  • The mirror plane position and normal
  • The current volume boundaries

The original data remains in the same location; only the volume extents change.

Memory Considerations

Mirroring operations with padding may significantly increase memory usage if:

  • Large masks are mirrored
  • The padding expands the volume substantially
  • Multiple high-resolution datasets are open

Monitor system memory when working with large datasets.

Workflow Examples

Example 1: Sagittal Skull Reconstruction

Objective: Complete a hemiskull scan by mirroring across the sagittal plane.

1. Import the hemiskull surface or create a mask
2. Click "X-axis" to set normal to (1, 0, 0)
3. Adjust origin X to align with the midline
4. Enable "Show plane" to verify alignment
5. Enable **Pad images to cover mirrored region** if working with masks
6. Click "Apply"

Result: A complete bilateral skull.

Example 2: Mirroring Multiple Masks

Objective: Mirror several segmented structures together.

1. Select the masks you want to mirror in the object list or 3D view
2. Set **Target object(s)** to **Selected Masks**
3. Configure the mirror plane
4. Enable **Pad images to cover mirrored region**
5. Click "Apply"

Result: All selected masks are mirrored into the same mask objects.

Example 3: Surface and Mask Combined Mirroring

Objective: Mirror both surface models and segmentation masks in one operation.

1. Select the surfaces and masks you want to mirror
2. Set **Target object(s)** to **Visible Masks and Visible Surfaces** or **All Masks and All Surfaces**
3. Configure the mirror plane appropriately
4. Enable **Pad images to cover mirrored region** to ensure masks remain in bounds
5. Click "Apply"

Result: Surfaces and masks are updated in place.

Example 4: Angled Reflection Plane

Objective: Mirror an object across a custom-angled plane (not axis-aligned).

1. Enter the desired normal vector components (e.g., [0.707, 0.707, 0.0])
2. Set the origin to the desired intersection point
3. Enable "Show plane" to verify orientation
4. Apply the mirror operation

Result: Reflection across a plane at 45 degrees between X and Y axes.

Scripting API

The mirroring functionality is exposed via the Python Scripting API for automation.

Surface Mirroring

import ScriptingApi as api

app = api.Application()
surface_operations = app.get_surface_operations()

# Mirror surfaces across a plane
surface_operations.mirror_to_plane(
['Surface_1', 'Surface_2'], # surfaceNames
[50.0, 0.0, 0.0], # planeOrigin [x, y, z]
[1.0, 0.0, 0.0] # planeNormal [x, y, z]
)

Mask Mirroring

import ScriptingApi as api

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

# Mirror masks across a plane
mask_operations.mirror_to_plane(
['Mask_1', 'Mask_2'], # maskNames
[50.0, 0.0, 0.0], # planeOrigin [x, y, z]
[1.0, 0.0, 0.0] # planeNormal [x, y, z]
)

Volume Padding

import ScriptingApi as api

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

# Pad project's image data to accommodate mirrored geometry
volume_operations.pad(
'Volume_1', # volumeName to calculate required padding
['Surface_1'], # surfaceNames to consider
['Mask_1'], # maskNames to consider
[50.0, 0.0, 0.0], # planeOrigin [x, y, z]
[1.0, 0.0, 0.0] # planeNormal [x, y, z]
)

Best Practices

  • Use Reset first to center the plane, then adjust only the axis and offset you need.
  • Duplicate objects before mirroring if you need side-by-side comparison.
  • When mirroring masks, enable padding unless you are certain the reflected region stays within the volume.
  • For symmetry analysis, mirror once, then use transparency or distance measurements to quantify differences.

Common Issues and Solutions

IssueLikely CauseSolution
Mirrored mask appears cut offExceeded volume bounds without paddingEnable Pad images to cover mirrored region and reapply
Surface appears inside-outCorrupted surface before mirroringRun Diagnostics and Fixes before mirroring
Padding creates a very large volumePlane positioned far from dataMove the plane closer to the target objects
Cannot see preview surface for maskMask preview not generatedRegenerate mask preview or toggle mask visibility
Mirrored objects overlap originalPlane positioned through the objectExpected behavior; adjust plane if separation is needed
Wrong reflection directionIncorrect normal vectorUse quick alignment buttons or verify values

See Also