sct_image

Perform manipulations on images (e.g., pad, change space, split along dimension). Inputs can be a number, a 4d image, or several 3d images separated with ,

usage: sct_image -i <file> [<file> ...] [-h] [-o <file>] [-pad <list>]
                 [-pad-asym <list>] [-split {x,y,z,t}] [-concat {x,y,z,t}]
                 [-stitch] [-qc <folder>] [-qc-dataset <str>]
                 [-qc-subject <str>] [-remove-vol <list>] [-keep-vol <list>]
                 [-type {uint8,int16,int32,float32,complex64,float64,int8,uint16,uint32,int64,uint64}]
                 [-header [{sct,fslhd,nibabel}]] [-copy-header <file>]
                 [-set-sform-to-qform | -set-qform-to-sform] [-getorient]
                 [-setorient {LAS,LAI,LPS,LPI,LSA,LSP,LIA,LIP,RAS,RAI,RPS,RPI,RSA,RSP,RIA,RIP,ALS,ALI,ARS,ARI,ASL,ASR,AIL,AIR,PLS,PLI,PRS,PRI,PSL,PSR,PIL,PIR,SLA,SLP,SRA,SRP,SAL,SAR,SPL,SPR,ILA,ILP,IRA,IRP,IAL,IAR,IPL,IPR}]
                 [-flip {x,y,z,t}] [-transpose ax1,ax2,ax3] [-mcs] [-omc]
                 [-display-warp] [-to-fsl [<file> ...]] [-v <int>]

MANDATORY ARGUMENTS

-i

Input file(s). Example: data.nii.gz Note: Only -concat, -omc or -stitch support multiple input files. In those cases, separate filenames using spaces. Example usage: sct_image -i data1.nii.gz data2.nii.gz -concat

OPTIONAL ARGUMENTS

-o

Output file. Example: data_pad.nii.gz

IMAGE OPERATIONS

-pad

Pad 3D image. Specify padding as: x,y,z (in voxel). Example: 0,0,1

-pad-asym

Pad 3D image with asymmetric padding. Specify padding as: x_i,x_f,y_i,y_f,z_i,z_f (in voxel). Example: 0,0,5,10,1,1

-split

Possible choices: x, y, z, t

Split data along the specified dimension. The suffix _DIM+NUMBER will be added to the intput file name.

-concat

Possible choices: x, y, z, t

Concatenate data along the specified dimension

-stitch

Stitch multiple images acquired in the same orientation utilizing the algorithm by Lavdas, Glocker et al. (https://doi.org/10.1016/j.crad.2019.01.012).

Default: False

-qc

The path where the quality control generated content will be saved. (Note: QC reporting is only available for sct_image -stitch).

-qc-dataset

If provided, this string will be mentioned in the QC report as the dataset the process was run on. (Note: QC reporting is only available for sct_image -stitch).

-qc-subject

If provided, this string will be mentioned in the QC report as the subject the process was run on. (Note: QC reporting is only available for sct_image -stitch).

-remove-vol

Remove specific volumes from a 4d volume. Separate with ,. Example: 0,5,10

-keep-vol

Keep specific volumes from a 4d volume (remove others). Separate with ,. Example: 1,2,3,11

-type

Possible choices: uint8, int16, int32, float32, complex64, float64, int8, uint16, uint32, int64, uint64

Change file type

HEADER OPERATIONS

-header

Possible choices: sct, fslhd, nibabel

Print the header of a NIfTI file. You can select the output format of the header: ‘sct’ (default), ‘nibabel’ or ‘fslhd’.

-copy-header

Copy the NIfTI header of the source image (specified in -i) to the destination image (specified here) and save it into a new image (specified in -o).

!! WARNING: This command should ONLY be run to fix a wrong header (e.g., where the qform and/or sform between an image and a mask of the image do not match). Also note that the image is NOT affected by this command, so if the dimensions of the source and destination images do not match, then you should probably NOT use this command.

-set-sform-to-qform

Set the input image’s sform matrix equal to its qform matrix. Use this option when you need to enforce matching sform and qform matrices. This option can be used by itself, or in combination with other functions.

Default: False

-set-qform-to-sform

Set the input image’s qform matrix equal to its sform matrix. Use this option when you need to enforce matching sform and qform matrices. This option can be used by itself, or in combination with other functions.

Default: False

ORIENTATION OPERATIONS

-getorient

Get orientation of the input image

Default: False

-setorient

Possible choices: LAS, LAI, LPS, LPI, LSA, LSP, LIA, LIP, RAS, RAI, RPS, RPI, RSA, RSP, RIA, RIP, ALS, ALI, ARS, ARI, ASL, ASR, AIL, AIR, PLS, PLI, PRS, PRI, PSL, PSR, PIL, PIR, SLA, SLP, SRA, SRP, SAL, SAR, SPL, SPR, ILA, ILP, IRA, IRP, IAL, IAR, IPL, IPR

Set orientation of the input image (modifies BOTH the header and data array, similar to fslswapdim).

-flip

Possible choices: x, y, z, t

Flip an axis of the image’s data array. (This will not change the header orientation string.)

  • WARNING: This option should only be used to fix the data array when it does not match the orientation string in the header. We recommend that you investigate and understand where the mismatch originated from in the first place before using this option.

  • Example: For an image with ‘RPI’ in its header, -flip x will flip the LR axis of the data array.

-transpose

Transpose the axes (x,y,z) of the image’s data array. (This will not change the header orientation string.)

  • WARNING: This option should only be used to fix the data array when it does not match the orientation string in the header. We recommend that you investigate and understand where the mismatch originated from in the first place before using this option.

  • Example: For a 3D image with ‘RPI’ in its header, -transpose z,y,x will swap the LR and SI axes of the data array.

MULTI-COMPONENT OPERATIONS ON ITK COMPOSITE WARPING FIELDS

-mcs

Multi-component split: Split ITK warping field into three separate displacement fields. The suffixes _X, _Y and _Z will be added to the input file name.

Default: False

-omc

Multi-component merge: Merge inputted images into one multi-component image. Requires several inputs.

Default: False

WARPING FIELD OPERATIONS:

-display-warp

Create a grid and deform it using provided warping field.

Default: False

-to-fsl

Transform displacement field values to absolute FSL warps. To be used with FSL’s applywarp function with the --abs flag. Input the file that will be used as the input (source) for applywarp and optionally the target (ref). The target file is necessary for the case where the warp is in a different space than the target. For example, the inverse warps generated by sct_straighten_spinalcord. This feature has not been extensively validated so consider checking the results of applywarp against sct_apply_transfo before using in FSL pipelines. Example syntax: sct_image -i WARP_SRC2DEST -to-fsl IM_SRC (IM_DEST) -o WARP_FSL, followed by FSL: applywarp -i IM_SRC -r IM_DEST -w WARP_FSL --abs -o IM_SRC2DEST

Misc

-v

Possible choices: 0, 1, 2

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

Default: 1