Resample
The Resample tool changes the voxel dimensions and spacing of volume and mask data. Use resampling to upsample (increase resolution) or downsample (decrease resolution) images for specific processing requirements.
Accessing the Tool
- Navigate to the Image tab in the ribbon.
- Click Resample in the Transform section.
Concepts
| Term | Description |
|---|---|
| Upsampling | Increasing the number of voxels (smaller voxel size) |
| Downsampling | Decreasing the number of voxels (larger voxel size) |
| Interpolation | Method for calculating new voxel values |
Parameters
Interpolation Method
Select interpolation methods separately for volumes and masks:
| Method | Volume Use | Mask Use |
|---|---|---|
| Nearest | Fast, blocky results | Preserves label values |
| Linear | Smooth gradients | May introduce intermediate values |
| Cubic | Smoothest results | Not recommended for masks |
Always use Nearest interpolation for masks to preserve exact label values. Use Linear or Cubic for grayscale volumes.
Resampling Method
Choose the method to define target resolution:
| Method | Description |
|---|---|
| Voxel dimensions | Specify the target number of voxels in each direction |
| Pixel spacing | Specify the target voxel size in millimeters |
By Voxel Dimensions
| Parameter | Description |
|---|---|
| X (pixels) | Target width in voxels (2-2048) |
| Y (pixels) | Target height in voxels (2-2048) |
| Z (pixels) | Target depth in voxels (2-2048) |
By Pixel Spacing
| Parameter | Description |
|---|---|
| X (mm) | Target voxel width |
| Y (mm) | Target voxel height |
| Z (mm) | Target voxel depth |
Information Display
The tool shows:
- Current and target dimensions
- Current and target spacing
- Physical size (remains constant during resampling)
Workflow
- Open the Resample tool from the Image tab.
- Select the resampling mode (By Dimensions or By Spacing).
- Choose interpolation methods for volumes and masks.
- Enter target dimensions or spacing values.
- Review the information display to verify the resampling effect.
- Click Apply to resample the data.
Use Cases
Reducing Memory Usage
Downsample large datasets for:
- Faster visualization and interaction
- Reduced processing time for preliminary analysis
- Lower memory consumption
Matching Resolution Between Datasets
Align resolution when combining datasets:
- Identify the target resolution (usually the coarser dataset).
- Resample finer datasets to match.
- Enables direct comparison and fusion.
Preparing for Specific Algorithms
Some processing algorithms require specific resolutions:
- Neural network inputs may expect fixed dimensions
- Simulation meshes may have element size requirements
- Resample to meet these requirements
Isotropic Resampling
Convert anisotropic data (different spacing in each axis) to isotropic:
- Note the smallest spacing value.
- Set all three spacing values to this minimum.
- Results in cubic voxels for uniform analysis.
Affected Objects
Resampling affects:
- All volume objects
- All mask objects
All datasets are resampled to the same grid to maintain spatial alignment.
Quality Considerations
Upsampling Limitations
Upsampling cannot recover detail that doesn't exist in the original data. Interpolation creates smooth transitions but does not add real information.
Downsampling Information Loss
Downsampling permanently reduces detail. High-frequency features and fine structures may be lost. Consider keeping the original data if full resolution may be needed later.
Memory Impact
Resampling significantly affects memory usage:
Example: Doubling resolution in all dimensions increases memory by 8×.
Scripting
This operation is available via the Python scripting API using resample().
import ScriptingApi as api
app = api.Application()
volume_operations = app.get_volume_operations()
volume_operations.resample(
["Volume1"],
[256, 256, 128], # Target dimensions [x, y, z]
[0.5, 0.5, 1.0], # Target spacing [x, y, z] in mm
api.Interpolation.Linear, # Volume interpolation: Nearest, Linear, or Cubic
api.Interpolation.Nearest # Mask interpolation: Nearest recommended for masks
)
See the VolumeOperations API Reference for details.