Purpose

The module Resample3D resamples an image in 3D on an arbitrary planar parallel grid. NOTE: The orientation of the input image cannot be changed with this module. For that purpose, use the module Reformat instead.

Usage

Use either Image Size, Voxel Size, or Scale Factor to specify the output grid that is used to resample the image data.

Additionally, a Voxel Translation can be given to perform subvoxel translation of the output grid.

Alternatively, voxel size and voxel translation can be automatically derived from a reference image to make sure the resampled image and the reference image are correctly aligned (with respect to the world/patient coordinate system) after resampling. NOTE: The reference image must have the same orientation as the main input image!

note:If the resulting image size is fractional, the size will be rounded up to the next whole integer. The resulting image will therefore have a bigger physical size, because the resulting voxel size is not corrected for this. Missing values in the source image will be obtained by replicating the border values of the source image.

Details

Choose one of many Resampling Filter to be used for the resampling that differ importantly in both support (i.e. the number of input voxel required for the computation of an output voxel) and in smoothness (resp. their edge-preserving property).

The filtering is performed consecutively and separately for all dimensions (x, y, and z).

Tips

  • Note that Min/Max values are automatically taken over from the input image, even if filtered values would exceed this range. In these cases clamping to the min/max range is performed. This cannot be avoided due to the page-based/demand driven approach this module works with, so the user can only avoid it by changing the properties of the input image accordingly.
  • For changing the orientation or the ‘area’ (i.e. the extent or position of the image in patient space) covered by the image, Resample3D is not suited. In this case, the Reformat can be used, which allows to reformat and resample an image to an arbitrary image geometry. However, it does not provide as many different filters and has a different border handling.

Windows

Default Panel

../../../Modules/ML/MLGeometry1/mhelp/Images/Screenshots/Resample3D._default.png

Input Fields

input0

name: input0, type: Image

Input image.

input1

name: input1, type: Image

Optional reference image. Must have the same orientation as the input image!

Output Fields

output0

name: output0, type: Image

Resampled output image.

Parameter Fields

Field Index

Filter always: Bool Use isotropic voxel size: Bool
Filtering Tolerance: Double Voxel Size: Vector3
Image Size: Vector3 Voxel Translation: Vector3
Keep Constant: Enum  
Resample to reference image grid: Bool  
Resampling Filter: Enum  
Reset: Trigger  
Scale Factor: Vector3  

Visible Fields

Keep Constant

name: keep, type: Enum, default: Scale factor

Defines which property should be held constant if the input image changes.

Values:

Title Name
Image size Image size
Voxel size Voxel size
Scale factor Scale factor

Resampling Filter

name: filter, type: Enum, default: Lanczos_3

Defines the filter with which the voxel value of the resampled output image is determined.

The computation time is mainly dependent on the filter’s support, i.e. the number of neighboring image elements (to both directions) that are taken into account for the computation of an actual output image element.

Often used filters are Nearest_Neighbor, Triangle/Linear, Mitchell_et_al, and Lanczos_3.

Values:

Title Name Description
Nearest Neighbor Nearest_Neighbor
Support: 0.0 No filtering - does not change the image spectrum, i.e. does not create new gray values by interpolation. Note that if the center of a target voxel lies exactly on the boundary between two source voxels, the value will be taken from the one with the lower coordinate value (i.e. the left one in 1D).
Triangle/Linear Triangle/Linear
Support: 1.0 Fast, but not very high quality.
Hermite Hermite
Support: 1.0 f(t) = 2|t|3 - 3|t|2 + 1
Blackman Blackman
Support: 1.0 f(t) = 0.42 + 0.5 * cos(π * t) + 0.08 * cos(2.0 * π * t)
Hamming Hamming
Support: 1.0 f(t) = 0.54 + 0.46 * cos(π * t)
Hanning Hanning
Support: 1.0 f(t) = 0.5 + 0.5 * cos(π * t)
Gaussian Gaussian
Support: 1.5 Probably not a good interpolation function.
Bell/Quadratic Bell/Quadratic
Support: 1.5  
Cubic B-Spline Cubic_B-Spline
Support: 2.0  
Catrom Catrom
Support: 2.0  
Mitchell et al Mitchell_et_al
Support: 2.0 Often used, faster but somewhat smoother than Lanczos_3.
Trunc Sinc 4 Trunc_Sinc_4
Support: 4.0 Sharpest filter.
Lanczos 2 Lanczos_2
Support: 2.0  
Lanczos 3 Lanczos_3
Support: 3.0 Provides a good compromise between smoothness and sharpness.
Lanczos 4 Lanczos_4
Support: 4.0  
Box NNB Box_NNB
Support: 0.5 Fastest filter.

Use isotropic voxel size

name: isotropic, type: Bool, default: FALSE

If checked, an isotropic voxel size is obtained at the output (i.e. vx = vy = vz).

Filter always

name: filterAlways, type: Bool, default: FALSE, deprecated name: FilterForScale1

If checked, a filtering is always performed, independent of the Scale Factor factor. The input data is just passed to the output for the respective dimension.

Otherwise, a filtering is only performed if Scale Factor does not equal 1.0 for a dimension.

Filtering Tolerance

name: filterAlwaysTolerance, type: Double, default: 0

Sets the value threshold difference for shifting where a resampling should be performed.

If this value is set to 0, the filtering is disabled, if set to 1e-6, rounding errors are ignored.

Scale Factor

name: zoom, type: Vector3, default: 1 1 1

Sets the scale factor for the output image in comparison to the input image.

A value of 1.0 means identity.

Depends on Image Size and Voxel Size.

Image Size

name: imageSize, type: Vector3, default: 0 0 0

Sets the output image extent in voxel.

Depends on Scale Factor and Voxel Size.

Voxel Size

name: voxelSize, type: Vector3, default: 0 0 0

Sets the output voxel size in mm.

Depends on Scale Factor and Image Size.

Voxel Translation

name: subVoxelShift, type: Vector3, default: 0 0 0

Sets a translation vector for the output image.

For instance, a voxel translation of (-0.5) in x-direction moves the output grid half an input voxel to the left.

Hint: Usually this parameter is used to align the output to a reference grid. Enable Resample to reference image grid to let the module determine the shift from the input images automatically.

Resample to reference image grid

name: useReferenceImage, type: Bool, default: FALSE

If checked, Voxel Size and Voxel Translation will be copied from the reference image, making sure the grids of the resampled and of the reference image are correctly aligned (with respect to the world/patient coordinate system) after resampling.

Notes: * This option aligns the grids, but not the full images, i.e. there still might be a shift between resampled and reference image by an integer number of voxels. * Also, the module requires the reference image to have the exact same orientation as the main input image.

If an image shall be resampled to exactly the grid and extent of a reference image with arbitrary orientation, try to use the module Reformat.

Reset

name: reset, type: Trigger

If pressed, all parameters are reset to their default values.