sct_apply_transfo

Apply transformations. This function is a wrapper for antsApplyTransforms (ANTs).

usage: sct_apply_transfo -i <file> -d <file> -w <file> [<file> ...]
                         [-winv <file> [<file> ...]] [-crop {0,1,2,3}]
                         [-o <file>] [-x {nn,linear,spline,label}] [-h]
                         [-v <int>] [-r {0,1}]

MANDATORY ARGUMENTS

-i

Input image. Example: t2.nii.gz

-d

Destination image. For warping input images, the destination image defines the spacing, origin, size, and direction of the output warped image. Example: dest.nii.gz

-w

Transformation(s), which can be warping fields (nifti image) or affine transformation matrix (text file). Separate with space. Example: warp1.nii.gz warp2.nii.gz

OPTIONAL ARGUMENTS

-winv

Affine transformation(s) listed in flag -w which should be inverted before being used. Note that this only concerns affine transformation (not warping fields). If you would like to use an inverse warping field, then directly input the inverse warping field in flag -w.

Default: []

-crop

Possible choices: 0, 1, 2, 3

Crop the output image using the extents of the warping field.

  • 0: no cropping (WARNING: may result in duplicated output if the destination image’s FOV is larger than the FOV of the warping field)

  • 1: crop using a rectangular bounding box around the warping field (setting outside voxels to 0)

  • 2: crop using a rectangular bounding box around the warping field (changing the size of the output image)

  • 3: mask the output image (setting outside voxels to 0) using the warping field directly instead of using a rectangular bounding box around the warping field. Useful if Option 1 does not zero out enough voxels.

Default: 0

-o

Filename to use for the output image (i.e. the transformed image). Example: out.nii.gz

-x

Possible choices: nn, linear, spline, label

Interpolation method.

Note: The label method is a special interpolation method designed for single-voxel labels (e.g. disc labels used as registration landmarks, compression labels, etc.). This method is necessary because classical interpolation may corrupt the values of single-voxel labels, or cause them to disappear entirely. The function works by dilating each label, applying the transformation using nearest neighbour interpolation, then extracting the center-of-mass of each transformed ‘blob’ to get a single-voxel output label. Because the output is a single-voxel label, the -x label method is not appropriate for multi-voxel labeled segmentations (such as spinal cord or lesion masks).

Default: 'spline'

MISC ARGUMENTS

-v

Possible choices: 0, 1, 2

Verbosity. 0: Display only errors/warnings, 1: Errors/warnings + info messages, 2: Debug mode.

Default: 1

-r

Possible choices: 0, 1

Remove temporary files.

Default: 1