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}] [-o <file>]
                         [-x {nn,linear,spline,label}] [-h] [-v <int>]
                         [-profile-time [<file>]] [-trace-memory [<folder>]]
                         [-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

Crop Reference. 0: no reference, 1: sets background to 0, 2: use normal background.

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

-profile-time

Enables time-based profiling of the program, dumping the results to the specified file.

If no file is specified, human-readable results are placed into a ‘time_profiling_results.txt’ document in the current directory (’/home/docs/checkouts/readthedocs.org/user_builds/spinalcordtoolbox/checkouts/stable/documentation/source’). If the specified file is a .prof file, the file will instead be in binary format, ready for use with common post-profiler utilities (such as snakeviz).

-trace-memory

Enables memory tracing of the program.

When active, a measure of the peak memory (in KiB) will be output to the file peak_memory.txt. Optionally, developers can also modify the SCT code to add additional snapshot_memory() calls. These calls will ‘snapshot’ the memory usage at that moment, saving the memory trace at that point into a second file (memory_snapshots.txt).

By default, both outputs will be placed in the current directory (’/home/docs/checkouts/readthedocs.org/user_builds/spinalcordtoolbox/checkouts/stable/documentation/source’). Optionally, you may provide an alternative directory (-trace-memory <dir_name>), in which case all files will be placed in that directory instead. Note that this WILL incur an overhead to runtime, so it is generally advised that you do not run this in conjunction with the time profiler or in time-sensitive contexts.

-r

Possible choices: 0, 1

Remove temporary files.

Default: 1