Skip to main content

Padding

The Pad and Surface-Guided Pad tools add voxels around the borders of volume and mask data, extending the image extent. Padding is useful for ensuring sufficient space around objects for processing operations or to accommodate geometry that extends to the image boundaries.


Pad​

The standard Pad tool adds a specified number of voxels to each side of the image.

The same image extent under Crop, Shrink, and Pad, where a ring of voxels is added around every side

Accessing the Tool​

  1. Navigate to the Image tab in the ribbon.
  2. Click Pad in the Transform section.

Parameters​

Uniform Padding​

Enable Uniform padding to add the same number of voxels on all sides:

ParameterDescription
PixelsNumber of voxels to add uniformly (1–1023)

Directional Padding​

Disable uniform padding to specify padding for each direction independently:

ParameterDescription
-XVoxels to add at the lower X boundary (0-1023)
+XVoxels to add at the upper X boundary (0-1023)
-YVoxels to add at the lower Y boundary (0-1023)
+YVoxels to add at the upper Y boundary (0-1023)
-ZVoxels to add at the lower Z boundary (0-1023)
+ZVoxels to add at the upper Z boundary (0-1023)

Padding Value​

New voxels are initialized to zero (background intensity).

Workflow​

  1. Open the Pad tool from the Image tab.
  2. Choose between Uniform or Directional padding.
  3. Enter the desired padding values in pixels.
  4. Click Apply to add padding.

Surface-Guided Pad​

The Surface-Guided Pad tool automatically calculates the padding required to ensure surface objects remain within the volume bounds.

Accessing the Tool​

  1. Navigate to the Image tab in the ribbon.
  2. Click Surface-Guided Pad in the Transform section.

How It Works​

  1. The tool analyzes the extents of selected surface objects.
  2. It calculates how much each surface extends beyond the current volume bounds.
  3. Padding is automatically applied to contain all surfaces.

Parameters​

ParameterDescription
Target volumeThe volume to which padding will be applied
Surface objectsSurfaces used to calculate required padding

Use Case​

When surface meshes extend beyond the volume boundaries (e.g., after smoothing or modification):

  1. Operations requiring the surface to be within the volume may fail.
  2. Surface-Guided Pad automatically resolves this issue.
  3. The volume is expanded minimally to contain all surfaces.

When to Use Padding​

Before Morphological Operations​

Erosion and dilation operations may produce unexpected results at image boundaries. Add padding to:

  • Ensure consistent behavior at edges
  • Prevent boundary artifacts

After Surface Modifications​

If surface processing (smoothing, subdivision) causes geometry to extend beyond volume bounds:

  • Use Surface-Guided Pad to automatically expand the volume
  • Maintains proper spatial relationship between surfaces and volumes

For Simulation Boundaries​

Finite element or CFD simulations may require buffer zones:

  • Add padding to create space for boundary conditions
  • Ensure simulation domains don't clip important geometry

Affected Objects​

Padding affects:

  • All volume objects
  • All mask objects

All datasets are padded equally to maintain spatial alignment.

info

Padding increases memory usage proportionally. A 10-pixel uniform pad on a 500×500×500 volume increases size to 520×520×520, adding approximately 13% more voxels.


Scripting​

Padding operations are available via the Python scripting API.

import ScriptingApi as api

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

# Add padding (lower and upper bounds in voxels)
volume_operations.pad(
["Volume1"],
[10, 10, 10], # Lower bound padding [x, y, z]
[10, 10, 10] # Upper bound padding [x, y, z]
)

# Surface-guided padding
volume_operations.surface_guided_padding("Volume1", ["Surface1", "Surface2"])

See the VolumeOperations API Reference for details.

warning

Padding modifies image origin and extent metadata. Verify coordinate alignment after padding if precise positioning is required.