Command-Line Tools#

Summary of Tools#

The command-line tools are named sct_*; to see all the commands available from SCT, start a new Terminal and type sct then press “tab”.

Segmentation#

Segmentation Analysis#

Labeling#

Registration#

Diffusion MRI#

Magnetization transfer#

Functional MRI#

Metric processing#

  • sct_analyze_texture - Extraction of grey level co-occurence matrix (GLCM) texture features from an image within a given mask.

  • sct_extract_metric - Estimate metric value within tracts, taking into account partial volume effect.

Image manipulation#

Miscellaneous#

System tools#

Main Tools#

sct_analyze_lesion#

--
Spinal Cord Toolbox (6.3.dev0)

sct_analyze_lesion -h
--

usage: sct_analyze_lesion -m <file> [-h] [-s <file>] [-i <file>] [-f <str>]
                          [-ofolder <folder>] [-r {0,1}] [-v <int>]

Compute statistics on segmented lesions. The function assigns an ID value to
each lesion (1, 2, 3, etc.) and then outputs morphometric measures for each
lesion:
- volume [mm^3]
- length [mm]: length along the Superior-Inferior axis
- max_equivalent_diameter [mm]: maximum diameter of the lesion, when
approximating the lesion as a circle in the axial plane
- max_axial_damage_ratio []: maximum ratio of the lesion area divided by the
spinal cord area

If the proportion of lesion in each region (e.g. WM and GM) does not sum up to
100%, it means that the registered template does not fully cover the lesion. In
that case you might want to check the registration results.

MANDATORY ARGUMENTS:
  -m <file>          Binary mask of lesions (lesions are labeled as "1").

OPTIONAL ARGUMENTS:
  -h, --help         show this help message and exit
  -s <file>          Spinal cord centerline or segmentation file, which will be
                     used to correct morphometric measures with cord angle with
                     respect to slice. (e.g. 't2_seg.nii.gz')
                     If provided, then the lesion volume, length, diameter, and
                     axial damage ratio will be computed. Otherwise, if not
                     provided, then only the lesion volume will be computed.
  -i <file>          Image from which to extract average values within lesions
                     (e.g. "t2.nii.gz"). If provided, the function computes the
                     mean and standard deviation values of this image within
                     each lesion.
  -f <str>           Path to folder containing the atlas/template registered to
                     the anatomical image. If provided, the function computes:
                     (i) the distribution of each lesion depending on each
                     vertebral level and on each region of the template (e.g.
                     GM, WM, WM tracts) and (ii) the proportion of ROI (e.g.
                     vertebral level, GM, WM) occupied by lesion.
  -ofolder <folder>  Output folder (e.g. ".") (default: .)
  -r {0,1}           Remove temporary files. (default: 1)
  -v <int>           Verbosity. 0: Display only errors/warnings, 1:
                     Errors/warnings + info messages, 2: Debug mode (default: 1)

sct_analyze_texture#

--
Spinal Cord Toolbox (6.3.dev0)

sct_analyze_texture -h
--

usage: sct_analyze_texture -i <file> -m <file> [-h] [-feature <str>]
                           [-distance <int>] [-angle <list>] [-dim {ax,sag,cor}]
                           [-ofolder <folder>] [-r {0,1}] [-v <int>]

Extraction of gray level co-occurence matrix (GLCM) texture features from an
image within a given mask. The textures features are those defined in the sckit-
image implementation: https://scikit-
image.org/docs/dev/api/skimage.feature.html#graycoprops. This function outputs
one nifti file per texture metric
(contrast,dissimilarity,homogeneity,energy,correlation,ASM) and per orientation
called fnameInput_feature_distance_angle.nii.gz. Also, a file averaging each
metric across the angles, called fnameInput_feature_distance_mean.nii.gz, is
output.

MANDATORY ARGUMENTS:
  -i <file>          Image to analyze. Example: t2.nii.gz
  -m <file>          Image mask Example: t2_seg.nii.gz

OPTIONALS ARGUMENTS:
  -h, --help         Show this help message and exit
  -feature <str>     List of GLCM texture features (separate arguments with
                     ","). (default:
                     contrast,dissimilarity,homogeneity,energy,correlation,ASM)
  -distance <int>    Distance offset for GLCM computation, in pixel (suggested
                     distance values between 1 and 5). Example: 1 (default: 1)
  -angle <list>      List of angles for GLCM computation, separate arguments
                     with ",", in degrees (suggested distance values between 0
                     and 179). Example: 0,90 (default: 0,45,90,135)
  -dim {ax,sag,cor}  Compute the texture on the axial (ax), sagittal (sag) or
                     coronal (cor) slices. (default: ax)
  -ofolder <folder>  Output folder. Example: /my_texture/ (default: ./texture)
  -r {0,1}           Remove temporary files. (default: 1)
  -v <int>           Verbosity. 0: Display only errors/warnings, 1:
                     Errors/warnings + info messages, 2: Debug mode (default: 1)

sct_apply_transfo#

--
Spinal Cord Toolbox (6.3.dev0)

sct_apply_transfo -h
--

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

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

MANDATORY ARGUMENTS:
  -i <file>             Input image. Example: t2.nii.gz
  -d <file>             Destination image. Example: out.nii.gz
  -w <file> [<file> ...]
                        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 <file> [<file> ...]
                        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.
  -h, --help            Show this help message and exit
  -crop {0,1,2}         Crop Reference. 0: no reference, 1: sets background to
                        0, 2: use normal background. (default: 0)
  -o <file>             Registered source. Example: dest.nii.gz
  -x {nn,linear,spline,label}
                         Interpolation method. The 'label' method is to be used
                         if you would like to apply a transformation
                                on a file that has single-voxel labels
                                (classical interpolation methods won't work, as
                                resampled labels might
                                disappear or their values be altered). The
                                function will dilate each label, apply the
                                transformation using
                                nearest neighbour interpolation, and then take
                                the center-of-mass of each "blob" and output a
                                single voxel per
                                blob. (default: spline)
  -r {0,1}              Remove temporary files. (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_compute_ernst_angle#

--
Spinal Cord Toolbox (6.3.dev0)

sct_compute_ernst_angle -h
--

usage: sct_compute_ernst_angle -tr <float> [-h] [-t1 <float>]
                               [-b <float> <float>] [-o <str>] [-ofig <str>]
                               [-v <int>]

Function to compute the Ernst Angle. For examples of T1 values in the brain, see
Wansapura et al. NMR relaxation times in the human brain at 3.0 tesla. Journal
of magnetic resonance imaging : JMRI (1999) vol. 9 (4) pp. 531-8.
T1 in WM: 832ms
T1 in GM: 1331ms

MANDATORY ARGUMENTS:
  -tr <float>         Value of TR (in ms) to get the Ernst Angle. Example: 2000

OPTIONAL ARGUMENTS:
  -h, --help          Show this help message and exit
  -t1 <float>         T1 value (in ms). Example: 832.3 (default: 832.0)
  -b <float> <float>  Min/Max range of TR (in ms) separated with space. Only use
                      with -v 2. Example: 500 3500 (default: [500, 3500])
  -o <str>            Name of the output file containing Ernst angle result.
                      (default: ernst_angle.txt)
  -ofig <str>         Name of the output graph. Only use with -v 2. (default:
                      ernst_angle.png)
  -v <int>            Verbosity. 0: Display only errors/warnings, 1:
                      Errors/warnings + info messages, 2: Debug mode (default:
                      1)

sct_compute_hausdorff_distance#

--
Spinal Cord Toolbox (6.3.dev0)

sct_compute_hausdorff_distance -h
--

usage: sct_compute_hausdorff_distance -i <file> [-h] [-d <file>]
                                      [-thinning {0,1}] [-resampling <float>]
                                      [-o <str>] [-v <int>]

Compute the Hausdorff's distance between two binary images which can be thinned
(ie skeletonized). If only one image is inputted, it will be only thinned

MANDATORY ARGUMENTS:
  -i <file>            First Image on which you want to find the skeleton
                       Example: t2star_manual_gmseg.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help           show this help message and exit
  -d <file>            Second Image on which you want to find the skeleton
                       Example: t2star_manual_gmseg.nii.gz
  -thinning {0,1}      Thinning : find the skeleton of the binary images using
                       the Zhang-Suen algorithm (1984) and use it to compute the
                       hausdorff's distance (default: 1)
  -resampling <float>  pixel size in mm to resample to Example: 0.5 (default:
                       0.1)
  -o <str>             Name of the output file Example: my_hausdorff_dist.txt
                       (default: hausdorff_distance.txt)
  -v <int>             Verbosity. 0: Display only errors/warnings, 1:
                       Errors/warnings + info messages, 2: Debug mode (default:
                       1)

sct_compute_compression#

--
Spinal Cord Toolbox (6.3.dev0)

sct_compute_compression -h
--

usage: sct_compute_compression -i <file> -vertfile <file> -l <file>
                               [-metric {diameter_AP,area,diameter_RL,eccentricity,solidity}]
                               [-normalize-hc <int>] [-extent <float>]
                               [-distance <float>] [-sex {F,M}] [-age [0 100]
                               [0 100]] [-o <file>] [-h] [-v <int>]

Compute normalized morphometric metrics to assess:
        - spinal cord compression using MSCC (maximum spinal cord compression)
        - spinal canal stenosis using MCC (maximum canal compromise)

Metrics are normalized using the non-compressed levels above and below the
compression site using the following equation:

    ratio = (1 - mi/((ma+mb)/2))

Where mi: metric at the compression level, ma: metric above the compression
level, mb: metric below the compression level.

Additionally, if the "-normalize-hc" flag is used, metrics are normalized using
a database built from healthy control subjects. This database uses the PAM50
template as an anatomical reference system.

References:
  - Sandrine Bédard, Jan Valošek, Maryam Seif, Armin Curt, Simon Schading,
    Nikolai Pfender, Patrick Freund, Markus Hupp, Julien Cohen-Adad. Normalizing
    Spinal Cord Compression Morphometric Measures: Application in Degenerative
    Cervical Myelopathy. medRxiv 2024.03.13.24304177
    https://doi.org/10.1101/2024.03.13.24304177
  - Miyanji F, Furlan JC, Aarabi B, Arnold PM, Fehlings MG. Acute cervical
    traumatic spinal cord injury: MR imaging findings correlated with neurologic
    outcome--prospective study with 100 consecutive patients. Radiology
    2007;243(3):820-827.
    https://doi.org/10.1148/radiol.2433060583
  - "-normalize-hc" flag:
    Valošek J, Bédard S, Keřkovský M, Rohan T, Cohen-Adad J. A database of the
    healthy human spinal cord morphometry in the PAM50 template space. Imaging
    Neuroscience 2024; 2 1–15.
    https://doi.org/10.1162/imag_a_00075

MANDATORY ARGUMENTS:
  -i <file>             Spinal cord or spinal canal segmentation mask to compute
                        morphometrics from. If spinal cord segmentation is
                        provided, MSCC is computed. If spinal canal segmentation
                        (spinal cord + CSF) is provided, MCC is computed.
                        Example: sub-001_T2w_seg.nii.gz
                        Note: If no normalization is wanted (i.e., if the
                        "-normalize-hc" flag is not specified), metric ratio
                        will take the average along the segmentation centerline.
  -vertfile <file>      Vertebral labeling file. Example:
                        sub-001_T2w_seg_labeled.nii.gz
                        Note: The input and the vertebral labelling file must be
                        in the same voxel coordinate systemand must match the
                        dimensions between each other.
  -l <file>             NIfTI file that includes labels at the compression
                        sites. Each compression site is denoted by a single
                        voxel of value `1`. Example:
                        sub-001_T2w_compression_labels.nii.gz
                        Note: The input and the compression label file must be
                        in the same voxel coordinate system and must match the
                        dimensions between each other.
  -metric {diameter_AP,area,diameter_RL,eccentricity,solidity}
                        Metric to normalize.  (default: diameter_AP)
  -normalize-hc <int>   Set to 1 to normalize the metrics using a database of
                        healthy controls. Set to 0 to not normalize.
                        Note: This flag should not be set to 1 when computing
                        the MCC (i.e. using spinal canal segmentation). It
                        should only be used when computing the MSCC (i.e. using
                        spinal cord segmentation).

OPTIONAL ARGUMENTS:
  -extent <float>       Extent (in mm) to average metrics of healthy levels in
                        superior-inferior direction. (default: 20.0)
  -distance <float>     Distance (in mm) in the superior-inferior direction from
                        the compression to average healthy slices. (default:
                        10.0)
  -sex {F,M}            Sex of healthy subject to use for the normalization. By
                        default, both sexes are used. Set the "-normalize-hc 1"
                        to use this flag.
  -age [0 100] [0 100]  Age range of healthy subjects to use for the
                        normalization. Example: "-age 60 80". By default, all
                        ages are considered. Set the "-normalize-hc 1" to use
                        this flag.
  -o <file>             Output CSV file name. If not provided, the suffix
                        "_compression_metrics" is added to the file name
                        provided by the flag "-i".
  -h, --help            Show this help message and exit
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_compute_mtr#

--
Spinal Cord Toolbox (6.3.dev0)

sct_compute_mtr -h
--

usage: sct_compute_mtr -mt0 <float> -mt1 <float> [-thr THR] [-h] [-v <int>]
                       [-o <str>]

Compute magnetization transfer ratio (MTR). Output is given in percentage.

MANDATORY ARGUMENTS:
  -mt0 <float>  Image without MT pulse (MT0)
  -mt1 <float>  Image with MT pulse (MT1)

OPTIONAL ARGUMENTS:
  -thr THR      Threshold to clip MTR output values in case of division by small
                number. This implies that the output image range will be [-thr,
                +thr]. Default: 100. (default: 100)
  -h, --help    Show this help message and exit
  -v <int>      Verbosity. 0: Display only errors/warnings, 1: Errors/warnings +
                info messages, 2: Debug mode (default: 1)
  -o <str>      Path to output file. (default: ./mtr.nii.gz)

sct_compute_mtsat#

--
Spinal Cord Toolbox (6.3.dev0)

sct_compute_mtsat -h
--

usage: sct_compute_mtsat -mt <file> -pd <file> -t1 <file> [-h] [-trmt <float>]
                         [-trpd <float>] [-trt1 <float>] [-famt <float>]
                         [-fapd <float>] [-fat1 <float>] [-b1map <file>]
                         [-omtsat <str>] [-ot1map <str>] [-v <int>]

Compute MTsat and T1map. Reference: Helms G, Dathe H, Kallenberg K, Dechent P.
High-resolution maps of magnetization transfer with inherent correction for RF
inhomogeneity and T1 relaxation obtained from 3D FLASH MRI. Magn Reson Med
2008;60(6):1396-1407.

MANDATORY ARGUMENTS:
  -mt <file>     Image with MT_ON
  -pd <file>     Image PD weighted (typically, the MT_OFF)
  -t1 <file>     Image T1-weighted

OPTIONAL ARGUMENTS:
  -h, --help     Show this help message and exit
  -trmt <float>  TR [in s] for the MT image (MT on). By default, will be fetch
                 from the json sidecar (if it exists).
  -trpd <float>  TR [in s] for proton density weighted image (MT off). By
                 default, will be fetch from the json sidecar (if it exists).
  -trt1 <float>  TR [in s] for T1-weighted image. By default, will be fetch from
                 the json sidecar (if it exists).
  -famt <float>  Flip angle [in deg] for mt image. By default, will be fetch
                 from the json sidecar (if it exists).
  -fapd <float>  Flip angle [in deg] for pd image. By default, will be fetch
                 from the json sidecar (if it exists).
  -fat1 <float>  Flip angle [in deg] for t1 image. By default, will be fetch
                 from the json sidecar (if it exists).
  -b1map <file>  B1 map
  -omtsat <str>  Output file for MTsat (default: mtsat.nii.gz)
  -ot1map <str>  Output file for T1map (default: t1map.nii.gz)
  -v <int>       Verbosity. 0: Display only errors/warnings, 1: Errors/warnings
                 + info messages, 2: Debug mode (default: 1)

sct_compute_snr#

--
Spinal Cord Toolbox (6.3.dev0)

sct_compute_snr -h
--

usage: sct_compute_snr -i <file> [-h] [-m <file>] [-m-noise <file>]
                       [-method {diff,mult,single}] [-vol <str>]
                       [-rayleigh {0,1}] [-r {0,1}] [-v <int>] [-o <str>]

Compute SNR using methods described in [Dietrich et al., Measurement of signal-
to-noise ratios in MR images: Influence of multichannel coils, parallel imaging,
and reconstruction filters. J Magn Reson Imaging 2007; 26(2): 375-385].

MANDATORY ARGUMENTS:
  -i <file>             Image to compute the SNR on. (Example: b0s.nii.gz)
                        - For '-method diff' and '-method mult', the image must
                        be 4D, as SNR will be computed along the 4th dimension.
                        - For '-method single', the image can either be 3D or
                        4D. If a 4D image is passed, a specific 3D volume should
                        be specified using the '-vol' argument.

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -m <file>             Binary (or weighted) mask within which SNR will be
                        averaged. Example: dwi_moco_mean_seg.nii.gz
  -m-noise <file>       Binary (or weighted) mask within which noise will be
                        calculated. Only valid for '-method single'.
  -method {diff,mult,single}
                        Method to use to compute the SNR (default: diff):
                          - diff: Substract two volumes (defined by -vol) and
                            estimate noise variance within the ROI (flag '-m' is
                            required). Requires a 4D volume.
                          - mult: Estimate noise variance over time across
                            volumes specified with '-vol'. Requires a 4D volume.
                          - single: Compute the mean signal in the mask
                            specified by '-m' and estimate the noise variance in
                            a mask specified by '-m-noise'. If the noise mask is
                            in the background (air), the noise variance needs to
                            be corrected for Rayleigh distribution (set
                            '-rayleigh 1'). If the noise mask is located in a
                            region with high signal (eg: tissue), noise
                            distribution can be assumed Gaussian and there is no
                            need to correct for Rayleigh distribution (use
                            '-rayleigh 0'). This implementation corresponds to
                            the SNRstdv in the Dietrich et al. article. Uses a
                            3D or a 4D volume. If a 4D volume is input, the
                            volume to compute SNR on is specified by '-vol'.
                            (default: diff)
  -vol <str>            Volumes to compute SNR from. Separate with ',' (Example:
                        '-vol 0,1'), or select range using ':' (Example: '-vol
                        2:50'). If this argument is not passed:
                          - For '-method mult', all volumes will be used.
                          - For '-method diff', the first two volumes will be
                            used.
                          - For '-method single', the first volume will be used.
  -rayleigh {0,1}       Correct for Rayleigh distribution. It is recommended to
                        always use this correction for the 'diff' method and to
                        use it with the 'single' method in case the noise mask
                        is taken in a region with low SNR (e.g., the air).
                        (default: 1)
  -r {0,1}              Remove temporary files. (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -o <str>              File name to write the computed SNR to.

sct_convert#

--
Spinal Cord Toolbox (6.3.dev0)

sct_convert -h
--

usage: sct_convert -i <file> -o <str> [-h] [-squeeze {0,1}] [-v <int>]

Convert image file to another type.

MANDATORY ARGUMENTS:
  -i <file>       File input. Example: data.nii.gz
  -o <str>        File output (indicate new extension). Example: data.nii

OPTIONAL ARGUMENTS:
  -h, --help      Show this help message and exit
  -squeeze {0,1}  Sueeze data dimension (remove unused dimension) (default: 1)
  -v <int>        Verbosity. 0: Display only errors/warnings, 1: Errors/warnings
                  + info messages, 2: Debug mode (default: 1)

sct_create_mask#

--
Spinal Cord Toolbox (6.3.dev0)

sct_create_mask -h
--

usage: sct_create_mask -i <file> -p <str> [-h] [-size <str>]
                       [-f {cylinder,box,gaussian}] [-o <str>] [-r {0,1}]
                       [-v <int>]

Create mask along z direction.

MANDATORY ARGUMENTS:
  -i <file>             Image to create mask on. Only used to get header. Must
                        be 3D. Example: data.nii.gz
  -p <str>              Process to generate mask.
                          <coord,XxY>: Center mask at the X,Y coordinates. (e.g.
                          "coord,20x15")
                          <point,FILE>: Center mask at the X,Y coordinates of
                          the label defined in input volume FILE. (e.g.
                          "point,label.nii.gz")
                          <center>: Center mask in the middle of the FOV (nx/2,
                          ny/2).
                          <centerline,FILE>: At each slice, the mask is centered
                          at the spinal cord centerline, defined by the input
                          segmentation FILE. (e.g. "centerline,t2_seg.nii.gz")
                          (default: center)

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -size <str>           Diameter of the mask in the axial plane, given in pixel
                        (Example: 35) or in millimeter (Example: 35mm). If
                        shape=gaussian, size instead corresponds to "sigma"
                        (Example: 45). (default: 41)
  -f {cylinder,box,gaussian}
                        Shape of the mask (default: cylinder)
  -o <str>              Name of output mask, Example: data.nii
  -r {0,1}              Remove temporary files (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_crop_image#

--
Spinal Cord Toolbox (6.3.dev0)

sct_crop_image -h
--

usage: sct_crop_image -i <file> [-h] [-o <str>] [-dilate <list>] [-g {0,1}]
                      [-m <file>] [-ref <file>] [-xmin <int>] [-xmax <int>]
                      [-ymin <int>] [-ymax <int>] [-zmin <int>] [-zmax <int>]
                      [-b <int>] [-v <int>]

Tools to crop an image. Either via command line or via a Graphical User
Interface (GUI). See example usage at the end.

MANDATORY ARGUMENTS:
  -i <file>       Input image. Example: t2.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help      Show this help message and exit
  -o <str>        Output image. By default, the suffix '_crop' will be added to
                  the input image.
  -dilate <list>  Number of extra voxels to keep around the bounding box on each
                  side. Can be specified as a single number, or a list of 3
                  numbers separated by 'x'. For example:
                    - '-dilate 5' will add a margin of 5 voxels in each
                    direction
                    - '-dilate 2x3x0' will add margin of 2 voxels on each side
                    in the x-axis, 3 voxels on each side in the y-axis, and no
                    extra margin in the z-axis.
  -g {0,1}        0: Cropping via command line | 1: Cropping via GUI. Has
                  priority over -m. (default: 0)
  -m <file>       Binary mask that will be used to extract bounding box for
                  cropping the image. Has priority over -ref.
  -ref <file>     Image which dimensions (in the physical coordinate system)
                  will be used as a reference to crop the input image. Only
                  works for 3D images. Has priority over min/max method.
  -xmin <int>     Lower bound for cropping along X. (default: 0)
  -xmax <int>     Higher bound for cropping along X. Setting '-1' will crop to
                  the maximum dimension (i.e. no change), '-2' will crop to the
                  maximum dimension minus 1 slice, etc. (default: -1)
  -ymin <int>     Lower bound for cropping along Y. (default: 0)
  -ymax <int>     Higher bound for cropping along Y. Follows the same rules as
                  xmax. (default: -1)
  -zmin <int>     Lower bound for cropping along Z. (default: 0)
  -zmax <int>     Higher bound for cropping along Z. Follows the same rules as
                  xmax. (default: -1)
  -b <int>        If this flag is declared, the image will not be cropped (i.e.
                  the dimension will not change). Instead, voxels outside the
                  bounding box will be set to the value specified by this flag.
                  For example, to have zeros outside the bounding box, use: '-b
                  0'
  -v <int>        Verbosity. 0: Display only errors/warnings, 1: Errors/warnings
                  + info messages, 2: Debug mode (default: 1)

EXAMPLES:
- To crop an image using the GUI (this does not allow to crop along the right-
left dimension):
sct_crop_image -i t2.nii.gz -g 1

- To crop an image using a binary mask:
sct_crop_image -i t2.nii.gz -m mask.nii.gz

- To crop an image using a reference image:
sct_crop_image -i t2.nii.gz -ref mt1.nii.gz

- To crop an image by specifying min/max (you don't need to specify all
dimensions). In the example below, cropping will occur between x=5 and x=60, and
between z=5 and z=zmax-1
sct_crop_image -i t2.nii.gz -xmin 5 -xmax 60 -zmin 5 -zmax -2

- To crop an image using a binary mask, and keep a margin of 5 voxels on each
side in the x and y directions only:
sct_crop_image -i t2.nii.gz -m mask.nii.gz -dilate 5x5x0

sct_deepseg#

--
Spinal Cord Toolbox (6.3.dev0)

sct_deepseg -h
--

usage: sct_deepseg [-i <file> [<file> ...]] [-c <file> [<file> ...]] [-o <str>]
                   [-task <str> [<str> ...]] [-list-tasks]
                   [-install-task {seg_sc_t2star,seg_mice_sc,seg_mice_gm,seg_tumor_t2,seg_ms_sc_mp2rage,seg_ms_lesion_mp2rage,seg_tumor-edema-cavity_t1-t2,seg_exvivo_gm-wm_t2,seg_gm_sc_7t_t2star,seg_lumbar_sc_t2w,seg_sc_contrast_agnostic,seg_sc_lesion_t2w_sci,seg_spinal_rootlets_t2w,seg_mouse_gm_wm_t1w}]
                   [-thr <float>] [-r {0,1}] [-largest KEEP_LARGEST]
                   [-fill-holes {0,1}]
                   [-remove-small REMOVE_SMALL [REMOVE_SMALL ...]] [-v <int>]
                   [-h]

Segment an anatomical structure or pathologies according to the specified deep
learning model.

INPUT/OUTPUT:
  -i <file> [<file> ...]
                        Image to segment. Can be multiple images (separated with
                        space).
  -c <file> [<file> ...]
                        Type of image contrast. Indicates the order in which the
                        images have been presented with -i. Optional if only one
                        image is specified with -i. The contrasts should be
                        separated by spaces (e.g., -c t1 t2).
  -o <str>              Output file name. In case of multi-class segmentation,
                        class-specific suffixes will be added. By default,the
                        suffix specified in the packaged model will be added and
                        output extension will be .nii.gz.

TASKS:
  -task <str> [<str> ...]
                        Task to perform. It could either be a pre-installed
                        task, task that could be installed, or a custom task. To
                        list available tasks, run: sct_deepseg -list-tasks. To
                        use a custom task, indicate the path to the  ivadomed
                        packaged model (see https://ivadomed.org/en/latest/pretr
                        ained_models.html#packaged-model-format for more
                        details).  More than one path can be indicated
                        (separated with space) for cascaded application of the
                        models.
  -list-tasks           Display a list of tasks, along with detailed
                        descriptions (including information on how the model was
                        trained, what data it was trained on, any performance
                        evaluations, associated papers, etc.) (default: False)
  -install-task {seg_sc_t2star,seg_mice_sc,seg_mice_gm,seg_tumor_t2,seg_ms_sc_mp2rage,seg_ms_lesion_mp2rage,seg_tumor-edema-cavity_t1-t2,seg_exvivo_gm-wm_t2,seg_gm_sc_7t_t2star,seg_lumbar_sc_t2w,seg_sc_contrast_agnostic,seg_sc_lesion_t2w_sci,seg_spinal_rootlets_t2w,seg_mouse_gm_wm_t1w}
                        Install models that are required for specified task.

PARAMETERS:
  -thr <float>          Binarize segmentation with specified threshold. Set to 0
                        for no thresholding (i.e., soft segmentation). Default
                        value is model-specific and was set during optimization
                        (more info at https://github.com/sct-pipeline/deepseg-
                        threshold).
  -r {0,1}              Remove temporary files. (default: 1)
  -largest KEEP_LARGEST
                        Keep the largest connected-objects from the output
                        segmentation. Specify the number of objects to keep.To
                        keep all objects, set to 0
  -fill-holes {0,1}     Fill small holes in the segmentation.
  -remove-small REMOVE_SMALL [REMOVE_SMALL ...]
                        Minimal object size to keep with unit (mm3 or vox). A
                        single value can be provided or one value per prediction
                        class. Single value example: 1mm3, 5vox. Multiple values
                        example: 10 20 10vox (remove objects smaller than 10
                        voxels for class 1 and 3, and smaller than 20 voxels for
                        class 2).

MISC:
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -h, --help            Show this help message and exit

TASK                          DESCRIPTION
--------------------------------------------------------------------------------
seg_sc_t2star                 Cord segmentation on T2*-weighted contrast        
seg_mice_sc                   Cord segmentation on mouse MRI                    
seg_mice_gm                   Gray matter segmentation on mouse MRI             
seg_tumor_t2                  Cord tumor segmentation on T2-weighted contrast   
seg_ms_sc_mp2rage             Cord segmentation on MP2RAGE in MS patients       
seg_ms_lesion_mp2rage         MS lesion segmentation on cropped MP2RAGE data    
seg_tumor-edema-cavity_t1-t2  Multiclass cord tumor/edema/cavity segmentation   
seg_exvivo_gm-wm_t2           Grey/white matter seg on exvivo human T2w         
seg_gm_sc_7t_t2star           SC/GM seg on T2*-weighted contrast at 7T          
seg_lumbar_sc_t2w             Lumbar cord segmentation with 3D UNet             
seg_sc_contrast_agnostic      Spinal cord segmentation that is agnostic to
contrast
seg_sc_lesion_t2w_sci         Traumatic SCI spinal cord/lesion seg for T2w
contrast
seg_spinal_rootlets_t2w       Segmentation of spinal nerve rootlets for T2w
contrast
seg_mouse_gm_wm_t1w           Exvivo mouse GM/WM segmentation for T1w contrast  

Legend: installed | not installed

To read in-depth descriptions of the training data, model architecture, etc.
used for these tasks, type the following command:

    sct_deepseg -list-tasks

sct_deepseg_gm#

--
Spinal Cord Toolbox (6.3.dev0)

sct_deepseg_gm -h
--

usage: sct_deepseg_gm -i <file> [-h] [-o <file>] [-qc <str>] [-qc-dataset <str>]
                      [-qc-subject <str>] [-m {large,challenge}] [-thr <float>]
                      [-t] [-v <int>]

Spinal Cord Gray Matter (GM) Segmentation using deep dilated convolutions. The
contrast of the input image must be similar to a T2*-weighted image: WM dark, GM
bright and CSF bright. Reference: Perone CS, Calabrese E, Cohen-Adad J. Spinal
cord gray matter segmentation using deep dilated convolutions. Sci Rep
2018;8(1):5966.

MANDATORY ARGUMENTS:
  -i <file>             Image filename to segment (3D volume). Example:
                        t2s.nii.gz.

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -o <file>             Output segmentation file name. Example: sc_gm_seg.nii.gz

MISC:
  -qc <str>             The path where the quality control generated content
                        will be saved.
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on
  -m {large,challenge}  Model to use (large or challenge). The model 'large'
                        will be slower but will yield better results. The model
                        'challenge' was built using data from the following
                        challenge: goo.gl/h4AVar. (default: large)
  -thr <float>          Threshold to apply in the segmentation predictions, use
                        0 (zero) to disable it. Example: 0.999 (default: 0.999)
  -t                    Enable TTA (test-time augmentation). Better results, but
                        takes more time and provides non-deterministic results.
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_deepseg_lesion#

--
Spinal Cord Toolbox (6.3.dev0)

sct_deepseg_lesion -h
--

usage: sct_deepseg_lesion -i <file> -c {t2,t2_ax,t2s} [-h]
                          [-centerline {svm,cnn,viewer,file}]
                          [-file_centerline <str>] [-brain {0,1}]
                          [-ofolder <str>] [-r {0,1}] [-v <int>]

MS lesion Segmentation using convolutional networks. Reference: Gros C et al.
Automatic segmentation of the spinal cord and intramedullary multiple sclerosis
lesions with convolutional neural networks. Neuroimage. 2018 Oct 6;184:901-915.

MANDATORY ARGUMENTS:
  -i <file>             Input image. Example: t2.nii.gz
  -c {t2,t2_ax,t2s}     Type of image contrast.
                         t2: T2w scan with isotropic or anisotropic resolution.
                         t2_ax: T2w scan with axial orientation and thick
                         slices.
                         t2s: T2*w scan with axial orientation and thick slices.

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -centerline {svm,cnn,viewer,file}
                        Method used for extracting the centerline:
                         svm: Automatic detection using Support Vector Machine
                         algorithm.
                         cnn: Automatic detection using Convolutional Neural
                         Network.
                         viewer: Semi-automatic detection using manual selection
                         of a few points with an interactive viewer followed by
                         regularization.
                         file: Use an existing centerline (use with flag
                         -file_centerline) (default: svm)
  -file_centerline <str>
                        Input centerline file (to use with flag -centerline
                        file). Example: t2_centerline_manual.nii.gz
  -brain {0,1}          Indicate if the input image contains brain sections (to
                        speed up segmentation). This flag is only effective with
                        "-centerline cnn". (default: 1)
  -ofolder <str>        Output folder. Example: My_Output_Folder (default: /home
                        /docs/checkouts/readthedocs.org/user_builds/spinalcordto
                        olbox/checkouts/latest/documentation/source)
  -r {0,1}              Remove temporary files. (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_deepseg_sc#

--
Spinal Cord Toolbox (6.3.dev0)

sct_deepseg_sc -h
--

usage: sct_deepseg_sc -i <file> -c {t1,t2,t2s,dwi} [-h]
                      [-centerline {svm,cnn,viewer,file}]
                      [-file_centerline <str>] [-thr <float>] [-brain {0,1}]
                      [-kernel {2d,3d}] [-ofolder <str>] [-o <file>] [-r {0,1}]
                      [-v <int>] [-qc <str>] [-qc-dataset <str>]
                      [-qc-subject <str>]

Spinal Cord Segmentation using convolutional networks. Reference: Gros et al.
Automatic segmentation of the spinal cord and intramedullary multiple sclerosis
lesions with convolutional neural networks. Neuroimage. 2019 Jan 1;184:901-915.

MANDATORY ARGUMENTS:
  -i <file>             Input image. Example: t1.nii.gz
  -c {t1,t2,t2s,dwi}    Type of image contrast.

OPTIONAL ARGUMENTS:
  -h, --help            show this help message and exit
  -centerline {svm,cnn,viewer,file}
                        Method used for extracting the centerline:
                         svm: Automatic detection using Support Vector Machine
                         algorithm.
                         cnn: Automatic detection using Convolutional Neural
                         Network.
                         viewer: Semi-automatic detection using manual selection
                         of a few points with an interactive viewer followed by
                         regularization.
                         file: Use an existing centerline (use with flag
                         -file_centerline) (default: svm)
  -file_centerline <str>
                        Input centerline file (to use with flag -centerline
                        file). Example: t2_centerline_manual.nii.gz
  -thr <float>          Binarization threshold (between 0 and 1) to apply to the
                        segmentation prediction. Set to -1 for no binarization
                        (i.e. soft segmentation output). The default threshold
                        is specific to each contrast and was estimated using an
                        optimization algorithm. More details at:
                        https://github.com/sct-pipeline/deepseg-threshold.
  -brain {0,1}          Indicate if the input image contains brain sections (to
                        speed up segmentation). Only use with "-centerline cnn".
                        (default: 1 for T1/T2 contrasts, 0 for T2*/DWI
                        contrasts)
  -kernel {2d,3d}       Choice of kernel shape for the CNN. Segmentation with 3D
                        kernels is slower than with 2D kernels. (default: 2d)
  -ofolder <str>        Output folder. Example: My_Output_Folder  (default: /hom
                        e/docs/checkouts/readthedocs.org/user_builds/spinalcordt
                        oolbox/checkouts/latest/documentation/source)
  -o <file>             Output filename. Example: spinal_seg.nii.gz
  -r {0,1}              Remove temporary files. (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -qc <str>             The path where the quality control generated content
                        will be saved
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on

sct_denoising_onlm#

--
Spinal Cord Toolbox (6.3.dev0)

sct_denoising_onlm -h
--

usage: sct_denoising_onlm -i <file> [-h] [-p {Rician,Gaussian}] [-d <int>]
                          [-std <float>] [-o <str>] [-r {0,1}] [-v <int>]

Utility function to denoise images. Return the denoised image and also the
difference between the input and the output. The denoising algorithm is based on
the Non-local means methods (Pierrick Coupe, Jose Manjon, Montserrat Robles,
Louis Collins. “Adaptive Multiresolution Non-Local Means Filter for 3D MR Image
Denoising” IET Image Processing, Institution of Engineering and Technology,
2011). The implementation is based on Dipy (https://dipy.org/).

MANDATORY ARGUMENTS:
  -i <file>             Input NIFTI image to be denoised. Example:
                        image_input.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -p {Rician,Gaussian}  Type of assumed noise distribution. Default is: Rician.
                        (default: Rician)
  -d <int>              Threshold value for what to be considered as noise. The
                        standard deviation of the noise is calculated for values
                        below this limit. Not relevant if -std value is
                        precised. Default is 80. (default: 80)
  -std <float>          Standard deviation of the noise. If not specified, it is
                        calculated using a background of point of values below
                        the threshold value (parameter d).
  -o <str>              Name of the output NIFTI image.
  -r {0,1}              Remove temporary files. Specify 0 to get access to
                        temporary files. (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_detect_pmj#

--
Spinal Cord Toolbox (6.3.dev0)

sct_detect_pmj -h
--

usage: sct_detect_pmj -i <file> -c {t1,t2} [-h] [-s <file>] [-ofolder <folder>]
                      [-o <file>] [-qc <str>] [-qc-dataset <str>]
                      [-qc-subject <str>] [-r {0,1}] [-v <int>]

Detection of the Ponto-Medullary Junction (PMJ). This method is based on a
machine-learning algorithm published in (Gros et al. 2018, Medical Image
Analysis, https://doi.org/10.1016/j.media.2017.12.001). Two models are
available: one for T1w-like and another for T2w-like images. If the PMJ is
detected from the input image, a NIfTI mask is output ("*_pmj.nii.gz") with one
voxel (value=50) located at the predicted PMJ position. If the PMJ is not
detected, nothing is output.

MANDATORY ARGUMENTS:
  -i <file>          Input image. Example: t2.nii.gz
  -c {t1,t2}         Type of image contrast, if your contrast is not in the
                     available options (t1, t2), use t1 (cord bright/ CSF dark)
                     or t2 (cord dark / CSF bright)

OPTIONAL ARGUMENTS:
  -h, --help         Show this help message and exit
  -s <file>          SC segmentation or centerline mask. Provide this mask helps
                     the detection of the PMJ by indicating the position of the
                     SC in the Right-to-Left direction. Example: t2_seg.nii.gz
  -ofolder <folder>  Output folder. Example: My_Output_Folder
  -o <file>          Output filename. Example: pmj.nii.gz
  -qc <str>          The path where the quality control generated content will
                     be saved.
  -qc-dataset <str>  If provided, this string will be mentioned in the QC report
                     as the dataset the process was run on.
  -qc-subject <str>  If provided, this string will be mentioned in the QC report
                     as the subject the process was run on.
  -r {0,1}           Remove temporary files. (default: 1)
  -v <int>           Verbosity. 0: Display only errors/warnings, 1:
                     Errors/warnings + info messages, 2: Debug mode (default: 1)

sct_dice_coefficient#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dice_coefficient -h
--

usage: sct_dice_coefficient -i <file> -d <file> [-h] [-2d-slices {0,1,2}]
                            [-b <list>] [-bmax {0,1}] [-bzmax {0,1}]
                            [-bin {0,1}] [-o <str>] [-r {0,1}] [-v <int>]

Compute the Dice Coefficient. N.B.: indexing (in both time and space) starts
with 0 not 1! Inputting -1 for a size will set it to the full image extent for
that dimension.

MANDATORY ARGUMENTS:
  -i <file>           First input image. Example: t2_seg.nii.gz
  -d <file>           Second input image. Example: t2_manual_seg.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help          Show this help message and exit
  -2d-slices {0,1,2}  Compute DC on 2D slices in the specified dimension
  -b <list>           Bounding box with the coordinates of the origin and the
                      size of the box as follow:
                      x_origin,x_size,y_origin,y_size,z_origin,z_size. Example:
                      5,10,5,10,10,15
  -bmax {0,1}         Use maximum bounding box of the images union to compute
                      DC.
  -bzmax {0,1}        Use maximum bounding box of the images union in the "Z"
                      direction to compute DC.
  -bin {0,1}          Binarize image before computing DC. (Put non-zero-voxels
                      to 1)
  -o <str>            Output file with DC results (.txt). Example:
                      dice_coeff.txt
  -r {0,1}            Remove temporary files. (default: 1)
  -v <int>            Verbosity. 0: Display only errors/warnings, 1:
                      Errors/warnings + info messages, 2: Debug mode (default:
                      1)

sct_dmri_compute_bvalue#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_compute_bvalue -h
--

usage: sct_dmri_compute_bvalue -g <float> -b <float> -d <float> [-h] [-v <int>]

Calculate b-value (in mm^2/s).

MANDATORY ARGUMENTS:
  -g <float>  Amplitude of diffusion gradients (in mT/m). Example: 40
  -b <float>  Big delta: time between both diffusion gradients (in ms). Example:
              40
  -d <float>  Small delta: duration of each diffusion gradient (in ms). Example:
              30

OPTIONAL ARGUMENTS:
  -h, --help  Show this help message and exit
  -v <int>    Verbosity. 0: Display only errors/warnings, 1: Errors/warnings +
              info messages, 2: Debug mode (default: 1)

sct_dmri_compute_dti#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_compute_dti -h
--

usage: sct_dmri_compute_dti -i <file> -bval <file> -bvec <file> [-h]
                            [-method {standard,restore}] [-evecs {0,1}]
                            [-m <file>] [-o <str>] [-v <int>]

Compute Diffusion Tensor Images (DTI) using dipy.

MANDATORY ARGMENTS:
  -i <file>             Input 4d file. Example: dmri.nii.gz
  -bval <file>          Bvals file. Example: bvals.txt
  -bvec <file>          Bvecs file. Example: bvecs.txt

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -method {standard,restore}
                        Type of method to calculate the diffusion tensor:
                         standard: Standard equation [Basser, Biophys J 1994]
                         restore: Robust fitting with outlier detection [Chang,
                         MRM 2005] (default: standard)
  -evecs {0,1}          Output tensor eigenvectors and eigenvalues. (default: 0)
  -m <file>             Mask used to compute DTI in for faster processing.
                        Example: mask.nii.gz
  -o <str>              Output prefix. (default: dti_)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_dmri_concat_bvals#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_concat_bvals -h
--

usage: sct_dmri_concat_bvals -i <file> [<file> ...] [-h] [-o <file>] [-v <int>]

Concatenate bval files in time.

MANDATORY ARGUMENTS:
  -i <file> [<file> ...]
                        List of the bval files to concatenate. Example:
                        dmri_b700.bval dmri_b2000.bval

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -o <file>             Output file with bvals merged. Example:
                        dmri_b700_b2000_concat.bval
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_dmri_concat_bvecs#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_concat_bvecs -h
--

usage: sct_dmri_concat_bvecs -i <file> [<file> ...] [-h] [-o <file>] [-v <int>]

Concatenate bvec files in time. You can either use bvecs in lines or columns.
N.B.: Return bvecs in lines. If you need it in columns, please use
sct_dmri_transpose_bvecs afterwards.

MANDATORY ARGUMENTS:
  -i <file> [<file> ...]
                        List of the bvec files to concatenate. Example:
                        dmri_b700.bvec dmri_b2000.bvec

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -o <file>             Output file with bvecs concatenated. Example:
                        dmri_b700_b2000_concat.bvec
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_dmri_denoise_patch2self#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_denoise_patch2self -h
--

usage: sct_dmri_denoise_patch2self -i <file> -b <file> [-h]
                                   [-model {ols,ridge,lasso}] [-radius <int>]
                                   [-o <str>] [-v <int>]

Utility function to denoise diffusion MRI images. Returns the denoised image and
also the difference between the input and the output. The Patch2Self denoising
algorithm is based on self-supervised denoising via statistical independence of
noise, as described in the following publications:

- Fadnavis et al. Patch2Self: Denoising Diffusion MRI with Self-supervised
Learning. NeurIPS, 2020, Vol. 33. (https://arxiv.org/abs/2011.01355)
- Schilling et al. Patch2Self denoising of diffusion MRI in the cervical spinal
cord improves intra-cord contrast, signal modelling, repeatability, and feature
conspicuity. medRxiv, 2021.
(https://www.medrxiv.org/content/10.1101/2021.10.04.21264389v2)

The implementation is based on DIPY (https://docs.dipy.org/stable/examples_built
/preprocessing/denoise_patch2self.html).

MANDATORY ARGUMENTS:
  -i <file>             Input NIfTI image to be denoised. Example:
                        image_input.nii.gz
  -b <file>             Input bvals file corresponding to the NIfTI file to be
                        denoised. Example: filename.bval

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -model {ols,ridge,lasso}
                        Type of regression model used for self-supervised
                        training within Patch2Self. (default: ols)
  -radius <int>         Patch Radius used to generate p-neighbourhoods within
                        Patch2Self. Notes:
                        - A radius of '0' will use 1x1x1 p-neighbourhoods, a
                        radius of '1' will use 3x3x3 p-neighbourhoods, and so
                        on.
                        - For anisotropic patch sizes, provide a comma-delimited
                        list of 3 integers. (e.g. '-radius 0,1,0'). For
                        isotropic patch sizes, provide a single int value (e.g.
                        '-radius 0'). (default: 0)
  -o <str>              Name of the output NIFTI image.
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode.
                        (default: 1)

sct_dmri_display_bvecs#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_display_bvecs -h
--

usage: sct_dmri_display_bvecs -bvec <file> [-bval <file>] [-h] [-v <int>]

Display scatter plot of gradient directions from bvecs file. If you have multi-
shell acquisition,you can provide also bvals file to display individual shells
in q-space.

MANDATORY ARGUMENTS:
  -bvec <file>  Input bvecs file. Example: sub-001_dwi.bvec

OPTIONAL ARGUMENTS:
  -bval <file>  Input bval file (for multi-shell acquisition). Example:
                sub-001_dwi.bval
  -h, --help    Show this help message and exit.
  -v <int>      Verbosity. 0: Display only errors/warnings, 1: Errors/warnings +
                info messages, 2: Debug mode (default: 1)

sct_dmri_moco#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_moco -h
--

usage: sct_dmri_moco -i <file> -bvec <file> [-h] [-bval <file>]
                     [-bvalmin <float>] [-g <int>] [-m <file>] [-param <list>]
                     [-x {nn,linear,spline}] [-ofolder <folder>] [-r {0,1}]
                     [-v <int>] [-qc <folder>] [-qc-seg <file>]
                     [-qc-fps <float>] [-qc-dataset <str>] [-qc-subject <str>]

Motion correction of dMRI data. Some of the features to improve robustness were
proposed in Xu et al. (https://dx.doi.org/10.1016/j.neuroimage.2012.11.014) and
include:
  - group-wise (-g)
  - slice-wise regularized along z using polynomial function (-param). For more
    info about the method, type: isct_antsSliceRegularizedRegistration
  - masking (-m)
  - iterative averaging of target volume

The outputs of the motion correction process are:
  - the motion-corrected dMRI volumes
  - the time average of the corrected dMRI volumes with b == 0
  - the time average of the corrected dMRI volumes with b != 0
  - a time-series with 1 voxel in the XY plane, for the X and Y motion direction
    (two separate files), as required for FSL analysis.
  - a TSV file with one row for each time point, with the slice-wise average of
    the motion correction magnitude for that time point, that can be used for
    Quality Control.

MANDATORY ARGUMENTS:
  -i <file>             Diffusion data. Example: dmri.nii.gz
  -bvec <file>          Bvecs file. Example: bvecs.txt

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -bval <file>          Bvals file. Example: bvals.txt
  -bvalmin <float>      B-value threshold (in s/mm2) below which data is
                        considered as b=0. Example: 50.0 (default: 100)
  -g <int>              Group nvols successive dMRI volumes for more robustness.
                        Example: 2 (default: 3)
  -m <file>             Binary mask to limit voxels considered by the
                        registration metric. Example: dmri_mask.nii.gz
  -param <list>         Advanced parameters. Assign value with "=", and separate
                        arguments with ",".
                          - poly [int]: Degree of polynomial function used for
                            regularization along Z. For no regularization set to
                            0. Default=2.
                          - smooth [mm]: Smoothing kernel. Default=1.
                          - metric {MI, MeanSquares, CC}: Metric used for
                            registration. Default=MI.
                          - gradStep [float]: Searching step used by
                            registration algorithm. The higher the more
                            deformation allowed. Default=1.
                          - sample [None or 0-1]: Sampling rate used for
                            registration metric. Default=None.
  -x {nn,linear,spline}
                        Final interpolation. (default: spline)
  -ofolder <folder>     Output folder. Example: dmri_moco_results
  -r {0,1}              Remove temporary files. 0 = no, 1 = yes (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -qc <folder>          The path where the quality control generated content
                        will be saved. (Note: Both '-qc' and '-qc-seg' are
                        required in order to generate a QC report.)
  -qc-seg <file>        Segmentation of spinal cord to improve cropping in qc
                        report. (Note: Both '-qc' and '-qc-seg' are required in
                        order to generate a QC report.)
  -qc-fps <float>       This float number is the number of frames per second for
                        the output gif images. (default: 3)
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on.
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on.

sct_dmri_separate_b0_and_dwi#

https://raw.githubusercontent.com/spinalcordtoolbox/doc-figures/master/command-line/sct_dmri_separate_b0_and_dwi_example.png
--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_separate_b0_and_dwi -h
--

usage: sct_dmri_separate_b0_and_dwi -i <file> -bvec <file> [-h] [-a {0,1}]
                                    [-bval <file>] [-bvalmin <float>]
                                    [-ofolder <folder>] [-r {0,1}] [-v <int>]

Separate b=0 and DW images from diffusion dataset. The output files will have a
suffix (_b0 and _dwi) appended to the input file name.

MANDATORY ARGUMENTS:
  -i <file>          Diffusion data. Example: dmri.nii.gz
  -bvec <file>       Bvecs file. Example: bvecs.txt

OPTIONAL ARGUMENTS:
  -h, --help         Show this help message and exit.
  -a {0,1}           Average b=0 and DWI data. 0 = no, 1 = yes (default: 1)
  -bval <file>       bvals file. Used to identify low b-values (in case
                     different from 0). Example: bvals.txt
  -bvalmin <float>   B-value threshold (in s/mm2) below which data is considered
                     as b=0. Example: 50.0
  -ofolder <folder>  Output folder. Example: dmri_separate_results (default: .)
  -r {0,1}           Remove temporary files. 0 = no, 1 = yes (default: 1)
  -v <int>           Verbosity. 0: Display only errors/warnings, 1:
                     Errors/warnings + info messages, 2: Debug mode (default: 1)

sct_dmri_transpose_bvecs#

--
Spinal Cord Toolbox (6.3.dev0)

sct_dmri_transpose_bvecs -h
--

usage: sct_dmri_transpose_bvecs -bvec <file> [-h] [-o <file>] [-v <int>]

Transpose bvecs file (if necessary) to get nx3 structure.

MANDATORY ARGUMENTS:
  -bvec <file>  Input bvecs file. Example: bvecs.txt

OPTIONAL ARGUMENTS:
  -h, --help    Show this help message and exit.
  -o <file>     Output bvecs file. By default, input file is overwritten.
                Example: bvecs_t.txt
  -v <int>      Verbosity. 0: Display only errors/warnings, 1: Errors/warnings +
                info messages, 2: Debug mode (default: 1)

sct_download_data#

--
Spinal Cord Toolbox (6.3.dev0)

sct_download_data -h
--

usage: sct_download_data -d <dataset> [-h] [-o <folder>] [-k] [-v <int>]

Download binaries from the web.

MANDATORY ARGUMENTS:
  -d <dataset>  Name of the dataset, as listed in the table below.

OPTIONAL ARGUMENTS:
  -h, --help    Show this help message and exit.
  -o <folder>   Path to a directory to save the downloaded data.
                (If not provided, the dataset will be downloaded to the SCT
                installation directory by default. Directory will be created if
                it does not exist. Warning: existing data in the directory will
                be erased unless -k is provided.)
  -k            Keep existing data in destination directory. (default: False)
  -v <int>      Verbosity. 0: Display only errors/warnings, 1: Errors/warnings +
                info messages, 2: Debug mode (default: 1)

DATASET NAME                  TYPE
--------------------------------------------------
binaries_linux                Binaries
binaries_osx                  Binaries
binaries_win                  Binaries
sct_example_data              Datasets
sct_testing_data              Datasets
deepreg_models                Models
deepseg_gm_models             Models
deepseg_lesion_models         Models
deepseg_sc_models             Models
manual-correction             SCT Course Files
sct_course_data               SCT Course Files
MNI-Poly-AMU                  Templates
PAM50                         Templates
PAM50_normalized_metrics      Templates
exvivo_template               Templates

Legend: installed | not installed (in the $SCT_DIR/data folder)

sct_extract_metric#

--
Spinal Cord Toolbox (6.3.dev0)

sct_extract_metric -h
--

usage: sct_extract_metric -i <file> [-h] [-f <folder>] [-l <str>] [-list-labels]
                          [-method {ml,map,wa,bin,median,max}] [-append {0,1}]
                          [-combine {0,1}] [-o <file>] [-output-map <file>]
                          [-z <str>] [-perslice {0,1}] [-vert <str>]
                          [-vertfile <file>] [-perlevel <int>] [-v <int>]
                          [-param <str>] [-fix-label <list>] [-norm-file <file>]
                          [-norm-method {sbs,whole}] [-mask-weighted <file>]
                          [-discard-neg-val {0,1}]

This program extracts metrics (e.g., DTI or MTR) within labels. Labels could be
a single file or a folder generated with 'sct_warp_template' containing multiple
label files and a label description file (info_label.txt). The labels should be
in the same space coordinates as the input image.

The labels used by default are taken from the PAM50 template. To learn about the
available PAM50 white/grey matter atlas labels and their corresponding ID
values, please refer to:
https://spinalcordtoolbox.com/en/latest/overview/concepts/pam50.html#white-and-
grey-matter-atlas-pam50-atlas

To compute FA within labels 0, 2 and 3 within vertebral levels C2 to C7 using
binary method:
sct_extract_metric -i dti_FA.nii.gz -l 0,2,3 -vert 2:7 -method bin

To compute average MTR in a region defined by a single label file (could be
binary or 0-1 weighted mask) between slices 1 and 4:
sct_extract_metric -i mtr.nii.gz -f my_mask.nii.gz -z 1:4 -method wa

MANDATORY ARGUMENTS:
  -i <file>             Image file to extract metrics from. Example: FA.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -f <folder>           Single label file, or folder that contains WM tract
                        labels. Example: /home/docs/checkouts/readthedocs.org/us
                        er_builds/spinalcordtoolbox/envs/latest/lib/python3.9/si
                        te-packages/data/PAM50/atlas (default: label/atlas)
  -l <str>              Label IDs to extract the metric from. Default = all
                        labels. Separate labels with ','. To select a group of
                        consecutive labels use ':'. Example: 1:3 is equivalent
                        to 1,2,3. Maximum Likelihood (or MAP) is computed using
                        all tracts, but only values of the selected tracts are
                        reported.
  -list-labels          List available labels. These labels are defined in the
                        file 'info_label.txt' located in the folder specified by
                        the flag '-f'.
  -method {ml,map,wa,bin,median,max}
                        Method to extract metrics.
                          - ml: maximum likelihood.
                            This method is recommended for large labels and low
                            noise. Also, this method should only be used with
                            the PAM50 white/gray matter atlas, or with any
                            custom atlas as long as the sum across all labels
                            equals 1, in each voxel part of the atlas.
                          - map: maximum a posteriori.
                            Mean priors are estimated by maximum likelihood
                            within three clusters (white matter, gray matter and
                            CSF). Tract and noise variance are set with flag -p.
                            This method should only be used with the PAM50
                            white/gray matter atlas, or with any custom atlas as
                            long as the sum across all labels equals 1, in each
                            voxel part of the atlas.
                          - wa: weighted average
                          - bin: binarize mask (threshold=0.5)
                          - median: weighted median.
                            This implementation of the median treats quantiles
                            as a continuous (vs. discrete) function. For more
                            details, see https://pypi.org/project/wquantiles/
                          - max: for each z-slice of the input data, extract the
                            max value for each slice of the input data.
                            (default: wa)
  -append {0,1}         Whether to append results as a new line in the output
                        csv file instead of overwriting it. 0 = no, 1 = yes
                        (default: 0)
  -combine {0,1}        Whether to combine multiple labels into a single
                        estimation. 0 = no, 1 = yes (default: 0)
  -o <file>             File name of the output result file collecting the
                        metric estimation results. Include the '.csv' file
                        extension in the file name. Example: extract_metric.csv
                        (default: extract_metric.csv)
  -output-map <file>    File name for an image consisting of the atlas labels
                        multiplied by the estimated metric values yielding the
                        metric value map, useful to assess the metric estimation
                        and especially partial volume effects.
  -z <str>              Slice range to estimate the metric from. First slice is
                        0. Example: 5:23
                        You can also select specific slices using commas.
                        Example: 0,2,3,5,12'
  -perslice {0,1}       Whether to output one metric per slice instead of a
                        single output metric. 0 = no, 1 = yes.
                        Please note that when methods ml or map are used,
                        outputting a single metric per slice and then averaging
                        them all is not the same as outputting a single metric
                        at once across all slices.
  -vert <str>           Vertebral levels to compute the metrics across. Example:
                        2:9 for C2 to T2. If you also specify a range of slices
                        with flag `-z`, the intersection between the specified
                        slices and vertebral levels will be considered.
  -vertfile <file>      Vertebral labeling file. Only use with flag -vert.
                        The input Image and the vertebral labelling file must in
                        the same voxel coordinate system and must match the
                        dimensions between each other. (default:
                        ./label/template/PAM50_levels.nii.gz)
  -perlevel <int>       Whether to output one metric per vertebral level instead
                        of a single output metric. 0 = no, 1 = yes.
                        Please note that this flag needs to be used with the
                        -vert option. (default: 0)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

FOR ADVANCED USERS:
  -param <str>          Advanced parameters for the 'map' method. Separate with
                        comma. All items must be listed (separated with comma).
                          - #1: standard deviation of metrics across labels
                          - #2: standard deviation of the noise (assumed
                          Gaussian)
  -fix-label <list>     When using ML or MAP estimations, if you do not want to
                        estimate the metric in one label and fix its value to
                        avoid effects on other labels, specify
                        <label_ID>,<metric_value. Example: -fix-label 36,0 (Fix
                        the CSF value)
  -norm-file <file>     Filename of the label by which the user wants to
                        normalize.
  -norm-method {sbs,whole}
                        Method to use for normalization:
                          - sbs: normalization slice-by-slice
                          - whole: normalization by the metric value in the
                            whole label for all slices.
  -mask-weighted <file>
                        Nifti mask to weight each voxel during ML or MAP
                        estimation. Example: PAM50_wm.nii.gz
  -discard-neg-val {0,1}
                        Whether to discard voxels with negative value when
                        computing metrics statistics. 0 = no, 1 = yes (default:
                        0)

sct_flatten_sagittal#

--
Spinal Cord Toolbox (6.3.dev0)

sct_flatten_sagittal -h
--

usage: sct_flatten_sagittal -i <file> -s <file> [-h] [-v <int>]

Flatten the spinal cord such within the medial sagittal plane. Useful to make
nice pictures. Output data has suffix _flatten. Output type is float32
(regardless of input type) to minimize loss of precision during conversion.

MANDATORY ARGUMENTS:
  -i <file>   Input volume. Example: t2.nii.gz
  -s <file>   Spinal cord segmentation or centerline. Example: t2_seg.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help  Show this help message and exit.
  -v <int>    Verbosity. 0: Display only errors/warnings, 1: Errors/warnings +
              info messages, 2: Debug mode (default: 1)

sct_fmri_compute_tsnr#

--
Spinal Cord Toolbox (6.3.dev0)

sct_fmri_compute_tsnr -h
--

usage: sct_fmri_compute_tsnr -i <file> [-h] [-v <int>] [-o <file>]

Compute temporal SNR (tSNR) in fMRI time series.

MANDATORY ARGUMENTS:
  -i <file>   Input fMRI data. Example: fmri.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help  Show this help message and exit.
  -v <int>    Verbosity. 0: Display only errors/warnings, 1: Errors/warnings +
              info messages, 2: Debug mode (default: 1)
  -o <file>   tSNR data output file. Example: fmri_tsnr.nii.gz

sct_fmri_moco#

--
Spinal Cord Toolbox (6.3.dev0)

sct_fmri_moco -h
--

usage: sct_fmri_moco -i <file> [-h] [-g <int>] [-m <file>] [-param <list>]
                     [-ofolder <folder>] [-x {nn,linear,spline}] [-r <int>]
                     [-v <int>] [-qc <folder>] [-qc-seg <file>]
                     [-qc-fps <float>] [-qc-dataset <str>] [-qc-subject <str>]

Motion correction of fMRI data. Some robust features include:
  - group-wise (-g)
  - slice-wise regularized along z using polynomial function (-p)
    (For more info about the method, type:
    isct_antsSliceRegularizedRegistration)
  - masking (-m)
  - iterative averaging of target volume

The outputs of the motion correction process are:
  - the motion-corrected fMRI volumes
  - the time average of the corrected fMRI volumes
  - a time-series with 1 voxel in the XY plane, for the X and Y motion direction
    (two separate files), as required for FSL analysis.
  - a TSV file with one row for each time point, with the slice-wise average of
    the motion correction magnitude for that time point, that can be used for
    Quality Control.

MANDATORY ARGUMENTS:
  -i <file>             Input data (4D). Example: fmri.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -g <int>              Group nvols successive fMRI volumes for more robustness.
  -m <file>             Binary mask to limit voxels considered by the
                        registration metric.
  -param <list>         Advanced parameters. Assign value with "="; Separate
                        arguments with ",".
                          - poly [int]: Degree of polynomial function used for
                            regularization along Z. For no regularization set to
                            0. Default=2.
                          - smooth [mm]: Smoothing kernel. Default=0.
                          - iter [int]: Number of iterations. Default=10.
                          - metric {MI, MeanSquares, CC}: Metric used for
                            registration. Default=MeanSquares.
                          - gradStep [float]: Searching step used by
                            registration algorithm. The higher the more
                            deformation allowed. Default=1.
                          - sampling [None or 0-1]: Sampling rate used for
                            registration metric. Default=None.
                          - numTarget [int]: Target volume or group (starting
                            with 0). Default=0.
                          - iterAvg [int]: Iterative averaging: Target volume is
                            a weighted average of the previously-registered
                            volumes. Default=1.
  -ofolder <folder>     Output path. (default: .)
  -x {nn,linear,spline}
                        Final interpolation. (default: linear)
  -r <int>              Remove temporary files. 0 = no, 1 = yes (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -qc <folder>          The path where the quality control generated content
                        will be saved. (Note: Both '-qc' and '-qc-seg' are
                        required in order to generate a QC report.)
  -qc-seg <file>        Segmentation of spinal cord to improve cropping in qc
                        report. (Note: Both '-qc' and '-qc-seg' are required in
                        order to generate a QC report.)
  -qc-fps <float>       This float number is the number of frames per second for
                        the output gif images. (default: 3)
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on.
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on.

sct_get_centerline#

--
Spinal Cord Toolbox (6.3.dev0)

sct_get_centerline -h
--

usage: sct_get_centerline -i <file> [-h] [-c {t1,t2,t2s,dwi}]
                          [-method {optic,viewer,fitseg}]
                          [-centerline-algo {polyfit,bspline,linear,nurbs}]
                          [-centerline-smooth <int>] [-centerline-soft <int>]
                          [-extrapolation <int>] [-o <file>] [-gap <float>]
                          [-v <int>] [-r <int>] [-qc <folder>]
                          [-qc-dataset <str>] [-qc-subject <str>]

This function extracts the spinal cord centerline. Three methods are available:
'optic' (automatic), 'viewer' (manual), and 'fitseg' (applied on segmented
image). These functions output (i) a NIFTI file with labels corresponding to the
discrete centerline, and (ii) a csv file containing the float (more precise)
coordinates of the centerline in the RPI orientation.

Reference: C Gros, B De Leener, et al. Automatic spinal cord localization,
robust to MRI contrast using global curve optimization (2017).
doi.org/10.1016/j.media.2017.12.001

MANDATORY ARGUMENTS:
  -i <file>             Input image. Example: t1.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -c {t1,t2,t2s,dwi}    Type of image contrast. Only with method=optic.
  -method {optic,viewer,fitseg}
                        Method used for extracting the centerline.
                          - optic: automatic spinal cord detection method
                          - viewer: manual selection a few points followed by
                            interpolation
                          - fitseg: fit a regularized centerline on an already-
                            existing cord segmentation. This method will
                            interpolate if any slices are missing. Also, if
                            '-extrapolation 1' is specified, this method will
                            extrapolate beyond the segmentation boundaries
                            (i.e., every axial slice will exhibit a centerline
                            pixel). (default: optic)
  -centerline-algo {polyfit,bspline,linear,nurbs}
                        Algorithm for centerline fitting. Only relevant with
                        -method fitseg. (default: bspline)
  -centerline-smooth <int>
                        Degree of smoothing for centerline fitting. Only for
                        -centerline-algo {bspline, linear}. (default: 30)
  -centerline-soft <int>
                        Binary or soft centerline. 0 = binarized, 1 = soft. Only
                        relevant with -method fitseg. (default: 0)
  -extrapolation <int>  Extrapolate beyond the segmentation boundaries. 0 = no
                        extrapolation, 1 = extrapolation. Only relevant with
                        -method fitseg.Note: '-extrapolation 1' works best with
                        lower-order (linear, nurbs) centerline fitting
                        algorithms (default: 0)
  -o <file>             File name for the centerline output file. If file
                        extension is not provided, '.nii.gz' will be used by
                        default. If '-o' is not provided, then the output file
                        will be the input with suffix '_centerline'. Example:
                        'centerline_optic.nii.gz'
  -gap <float>          Gap in mm between manually selected points. Only with
                        method=viewer. (default: 20.0)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -r <int>              Whether to remove temporary files. 0 = no, 1 = yes
                        (default: 1)
  -qc <folder>          The path where the quality control generated content
                        will be saved.
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on.
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on.

sct_image#

--
Spinal Cord Toolbox (6.3.dev0)

sct_image -h
--

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>]

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 ","

MANDATORY ARGUMENTS:
  -i <file> [<file> ...]
                        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:
  -h, --help            Show this help message and exit
  -o <file>             Output file. Example: data_pad.nii.gz

IMAGE OPERATIONS:
  -pad <list>           Pad 3D image. Specify padding as: "x,y,z" (in voxel).
                        Example: "0,0,1"
  -pad-asym <list>      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 {x,y,z,t}      Split data along the specified dimension. The suffix
                        _DIM+NUMBER will be added to the intput file name.
  -concat {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 <folder>          The path where the quality control generated content
                        will be saved. (Note: QC reporting is only available for
                        'sct_image -stitch').
  -qc-dataset <str>     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 <str>     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 <list>    Remove specific volumes from a 4d volume. Separate with
                        ",". Example: "0,5,10"
  -keep-vol <list>      Keep specific volumes from a 4d volume (remove others).
                        Separate with ",". Example: "1,2,3,11"
  -type {uint8,int16,int32,float32,complex64,float64,int8,uint16,uint32,int64,uint64}
                        Change file type

HEADER OPERATIONS:
  -header [{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 <file>   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 {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 {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 ax1,ax2,ax3
                        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 suffix _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 [<file> ...]  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 <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_label_utils#

--
Spinal Cord Toolbox (6.3.dev0)

sct_label_utils -h
--

usage: sct_label_utils -i <file> [-o <file>] [-ilabel <file>]
                       (-add <int> | -create <list> | -create-add <list> | -create-seg <list> | -create-seg-mid <int> | -create-viewer <list> | -cubic-to-point | -disc <file> | -project-centerline <file> | -display | -increment | -vert-body <list> | -vert-continuous | -MSE <file> | -remove-reference <file> | -remove-sym <file> | -remove <list> | -keep <list>)
                       [-h] [-msg <str>] [-v <int>] [-qc <folder>]
                       [-qc-dataset <str>] [-qc-subject <str>]

Utility functions for label images.

REQUIRED I/O:
  -i <file>             Input image (Required) Example: t2_labels.nii.gz

OPTIONAL I/O:
  -o <file>             Output image. Note: Only some label utilities create an
                        output image. Example: t2_labels.nii.gz (default:
                        labels.nii.gz)
  -ilabel <file>        File that contain labels that you want to correct. It is
                        possible to add new points with this option. Use with
                        -create-viewer. Example: t2_labels_auto.nii.gz

LABEL FUNCTIONS:
  -add <int>            Add value to all labels. Value can be negative.
  -create <list>        Create labels in a new image. List labels as:
                        x1,y1,z1,value1:x2,y2,z2,value2. Example:
                        12,34,32,1:12,35,33,2
  -create-add <list>    Same as '-create', but add labels to the input image
                        instead of creating a new image. Example:
                        12,34,32,1:12,35,33,2
  -create-seg <list>    Create labels on a cord segmentation (or centerline)
                        image defined by '-i'. Each label should be specified
                        using the form 'v1,v2' where 'v1' is value of the slice
                        index along the inferior-superior axis, and 'v2' is the
                        value of the label. Separate each label with ':'.
                        Example: '-create-seg 5,1:14,2:23,3' adds three labels
                        at the axial slices 5, 14, and 23 (starting from the
                        most inferior slice).
  -create-seg-mid <int>
                        Similar to '-create-seg'. This option takes a single
                        label value, and will automatically select the mid-point
                        slice in the inferior-superior direction (so there is no
                        need for a slice index).
                        This is useful for when you have centered the field of
                        view of your data at a specific location. For example,
                        if you already know that the C2-C3 disc is centered in
                        the I-S direction, then you can enter '-create-seg-mid
                        3' for that label. This saves you the trouble of having
                        to manually specify a slice index using '-create-seg'.
  -create-viewer <list>
                        Manually label from a GUI a list of labels IDs. Provide
                        a comma-separated list containing individual values
                        and/or intervals. Example: '-create-viewer 1:4,6,8' will
                        allow you to add labels [1,2,3,4,6,8] using the GUI.
  -cubic-to-point       Compute the center-of-mass for each label value.
                        (default: False)
  -disc <file>          Project disc labels onto the spinal cord segmentation to
                        create a labeled segmentation. Note: Unlike
                        'sct_label_vertebrae -discfile', this function does not
                        involve cord straightening. The disc labeling follows
                        the convention: https://spinalcordtoolbox.com/user_secti
                        on/tutorials/vertebral-labeling/labeling-
                        conventions.html
  -project-centerline <file>
                        Project disc labels onto the spinal cord centerline.
  -display              Display all labels (i.e. non-zero values). (default:
                        False)
  -increment            Takes all non-zero values, sort them along the inverse z
                        direction, and attributes the values 1, 2, 3, etc.
                        (default: False)
  -vert-body <list>     From vertebral labeling, create points that are centered
                        at the mid-vertebral levels. Separate desired levels
                        with ','. Example: 3,8
                        To get all levels, enter 0.
  -vert-continuous      Convert discrete vertebral labeling to continuous
                        vertebral labeling. (default: False)
  -MSE <file>           Compute Mean Square Error between labels from input and
                        reference image. Specify reference image here.
  -remove-reference <file>
                        Remove labels from input image (-i) that are not in
                        reference image (specified here).
  -remove-sym <file>    Remove labels from input image (-i) and reference image
                        (specified here) that don't match. You must provide two
                        output names separated by ','.
  -remove <list>        Remove labels of specific value (specified here) from
                        reference image.
  -keep <list>          Keep labels of specific value (specified here) from
                        reference image.

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -msg <str>            Display a message to explain the labeling task. Use with
                        -create-viewer
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -qc <folder>          The path where the quality control generated content
                        will be saved.
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on.
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on.

sct_label_vertebrae#

--
Spinal Cord Toolbox (6.3.dev0)

sct_label_vertebrae -h
--

usage: sct_label_vertebrae -i <file> -s <file> -c {t1,t2} [-h] [-t <folder>]
                           [-initz <list>] [-initcenter <int>]
                           [-initfile <file>] [-initlabel <file>]
                           [-discfile <file>] [-ofolder <file>]
                           [-laplacian <int>] [-clean-labels <int>]
                           [-scale-dist <float>] [-param <list>] [-r <int>]
                           [-v <int>] [-qc <folder>] [-qc-dataset <str>]
                           [-qc-subject <str>]

This function takes an anatomical image and its cord segmentation (binary file),
and outputs the cord segmentation labeled with vertebral level. The algorithm
requires an initialization (first disc) and then performs a disc search in the
superior, then inferior direction, using template disc matching based on mutual
information score. The automatic method uses the module implemented in
'spinalcordtoolbox/vertebrae/detect_c2c3.py' to detect the C2-C3 disc.

MANDATORY ARGUMENTS:
  -i <file>            Input image. Example: t2.nii.gz
  -s <file>            Segmentation of the spinal cord. Example: t2_seg.nii.gz
  -c {t1,t2}           Type of image contrast. 't2': cord dark / CSF bright.
                       't1': cord bright / CSF dark

OPTIONAL ARGUMENTS:
  -h, --help           Show this help message and exit.
  -t <folder>          Path to template. (default: /home/docs/checkouts/readthed
                       ocs.org/user_builds/spinalcordtoolbox/envs/latest/lib/pyt
                       hon3.9/site-packages/data/PAM50)
  -initz <list>        Initialize using slice number and disc value. Example:
                       68,4 (slice 68 corresponds to disc C3/C4).
                       WARNING: Slice number should correspond to superior-
                       inferior direction (i.e. Z in RPI orientation, but Y in
                       LIP orientation).
  -initcenter <int>    Initialize using disc value centered in the rostro-caudal
                       direction. If the spine is curved, then consider the disc
                       that projects onto the cord at the center of the z-FOV.
  -initfile <file>     Initialize labeling by providing a text file which
                       includes either -initz or -initcenter flag.
  -initlabel <file>    Initialize vertebral labeling by providing a nifti file
                       that has a single disc label. An example of such file is
                       a single voxel with value '3', which would be located at
                       the posterior tip of C2-C3 disc. Such label file can be
                       created using: sct_label_utils -i IMAGE_REF -create-
                       viewer 3 ; or by using the Python module 'detect_c2c3'
                       implemented in
                       'spinalcordtoolbox/vertebrae/detect_c2c3.py'.
  -discfile <file>     File with disc labels, which will be used to transform
                       the input segmentation into a vertebral level file. In
                       that case, there will be no disc detection. The
                       convention for disc labels is the following: value=3 ->
                       disc C2/C3, value=4 -> disc C3/C4, etc.
  -ofolder <file>      Output folder.
  -laplacian <int>     Apply Laplacian filtering. More accurate but could
                       mistake disc depending on anatomy. (default: 0)
  -clean-labels <int>  Clean output labeled segmentation to resemble original
                       segmentation. 0: no cleaning, 1: remove labeled voxels
                       that fall outside the original segmentation, 2: `-clean-
                       labels 1`, plus also fill in voxels so that the labels
                       cover the entire original segmentation. (default: 1)
  -scale-dist <float>  Scaling factor to adjust the average distance between two
                       adjacent intervertebral discs. For example, if you are
                       dealing with images from pediatric population, the
                       distance should be reduced, so you can try a scaling
                       factor of about 0.7. (default: 1.0)
  -param <list>        Advanced parameters. Assign value with "="; Separate
                       arguments with ","
                         - shift_AP [mm]: AP shift of centerline for disc search
                         - size_AP [mm]: AP window size for disc search
                         - size_RL [mm]: RL window size for disc search
                         - size_IS [mm]: IS window size for disc search
                        (default: shift_AP=32,size_AP=11,size_RL=1,size_IS=19,sh
                        ift_AP_visu=15)
  -r <int>             Remove temporary files. (default: 1)
  -v <int>             Verbosity. 0: Display only errors/warnings, 1:
                       Errors/warnings + info messages, 2: Debug mode (default:
                       1)
  -qc <folder>         The path where the quality control generated content will
                       be saved.
  -qc-dataset <str>    If provided, this string will be mentioned in the QC
                       report as the dataset the process was run on.
  -qc-subject <str>    If provided, this string will be mentioned in the QC
                       report as the subject the process was run on.

sct_maths#

--
Spinal Cord Toolbox (6.3.dev0)

sct_maths -h
--

usage: sct_maths -i <file> -o <file> [-h] [-add [...]] [-sub  [...]]
                 [-mul [...]] [-div  [...]] [-mean {x,y,z,t}] [-rms {x,y,z,t}]
                 [-std {x,y,z,t}] [-bin <float>] [-otsu <int>] [-adap <list>]
                 [-otsu-median <list>] [-percent <int>] [-thr <float>]
                 [-uthr <float>] [-dilate <int>] [-erode <int>]
                 [-shape {square,cube,disk,ball}] [-dim {0,1,2}]
                 [-smooth <list>] [-laplacian <list>] [-denoise DENOISE]
                 [-mi <file>] [-minorm <file>] [-corr <file>]
                 [-symmetrize {0,1,2}]
                 [-type {uint8,int16,int32,float32,complex64,float64,int8,uint16,uint32,int64,uint64}]
                 [-v <int>]

Perform mathematical operations on images.

MANDATORY ARGUMENTS:
  -i <file>             Input file. Example: data.nii.gz
  -o <file>             Output file. Example: data_mean.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

BASIC OPERATIONS:
  -add [ ...]           Add following input. Can be a number or one or more
                        3D/4D images (separated with space). Examples:
                          - sct_maths -i 3D.nii.gz -add 5
                            (Result: 3D image with "5" added to each voxel)
                          - sct_maths -i 3D.nii.gz -add 3D_2.nii.gz
                            (Result: 3D image)
                          - sct_maths -i 4D.nii.gz -add 4D_2.nii.gz
                            (Result: 4D image)
                          - sct_maths -i 4D_nii.gz -add 4D_2.nii.gz 4D_3.nii.gz
                            (Result: 4D image)
                        Note: If your terminal supports it, you can also specify
                        multiple images using a pattern:
                          - sct_maths -i 4D.nii.gz -add 4D_*.nii.gz (Result:
                            Adding 4D_2.nii.gz, 4D_3.nii.gz, etc.)
                        Note: If the input image is 4D, you can also leave
                        "-add" empty to sum the 3D volumes within the image:
                          - sct_maths -i 4D.nii.gz -add             (Result: 3D
                            image, with 3D volumes summed within 4D image)
  -sub  [ ...]          Subtract following input. Can be a number, or one or
                        more 3D/4D images (separated with space).
  -mul [ ...]           Multiply by following input. Can be a number, or one or
                        more 3D/4D images (separated with space). (See -add for
                        examples.)
  -div  [ ...]          Divide by following input. Can be a number, or one or
                        more 3D/4D images (separated with space).
  -mean {x,y,z,t}       Average data across dimension.
  -rms {x,y,z,t}        Compute root-mean-squared across dimension.
  -std {x,y,z,t}        Compute STD across dimension.
  -bin <float>          Binarize image using specified threshold. Example: 0.5

THRESHOLDING METHODS:
  -otsu <int>           Threshold image using Otsu algorithm (from skimage).
                        Specify the number of bins (e.g. 16, 64, 128)
  -adap <list>          Threshold image using Adaptive algorithm (from skimage).
                        Provide 2 values separated by ',' that correspond to the
                        parameters below. For example, '-adap 7,0' corresponds
                        to a block size of 7 and an offset of 0.
                          - Block size: Odd size of pixel neighborhood which is
                            used to calculate the threshold value.
                          - Offset: Constant subtracted from weighted mean of
                            neighborhood to calculate the local threshold value.
                            Suggested offset is 0.
  -otsu-median <list>   Threshold image using Median Otsu algorithm (from dipy).
                        Provide 2 values separated by ',' that correspond to the
                        parameters below. For example, '-otsu-median 3,5'
                        corresponds to a filter size of 3 repeated over 5
                        iterations.
                          - Size: Radius (in voxels) of the applied median
                            filter.
                          - Iterations: Number of passes of the median filter.
  -percent <int>        Threshold image using percentile of its histogram.
  -thr <float>          Lower threshold limit (zero below number).
  -uthr <float>         Upper threshold limit (zero above number).

MATHEMATICAL MORPHOLOGY:
  -dilate <int>         Dilate binary or greyscale image with specified size. If
                        shape={'square', 'cube'}: size corresponds to the length
                        of an edge (size=1 has no effect). If shape={'disk',
                        'ball'}: size corresponds to the radius, not including
                        the center element (size=0 has no effect).
  -erode <int>          Erode binary or greyscale image with specified size. If
                        shape={'square', 'cube'}: size corresponds to the length
                        of an edge (size=1 has no effect). If shape={'disk',
                        'ball'}: size corresponds to the radius, not including
                        the center element (size=0 has no effect).
  -shape {square,cube,disk,ball}
                        Shape of the structuring element for the mathematical
                        morphology operation. Default: ball.
                        If a 2D shape {'disk', 'square'} is selected, -dim must
                        be specified. (default: ball)
  -dim {0,1,2}          Dimension of the array which 2D structural element will
                        be orthogonal to. For example, if you wish to apply a 2D
                        disk kernel in the X-Y plane, leaving Z unaffected,
                        parameters will be: shape=disk, dim=2.

FILTERING METHODS:
  -smooth <list>        Gaussian smoothing filtering. Supply values for standard
                        deviations in mm. If a single value is provided, it will
                        be applied to each axis of the image. If multiple values
                        are provided, there must be one value per image axis.
                        (Examples: "-smooth 2.0,3.0,2.0" (3D image), "-smooth
                        2.0" (any-D image)).
  -laplacian <list>     Laplacian filtering. Supply values for standard
                        deviations in mm. If a single value is provided, it will
                        be applied to each axis of the image. If multiple values
                        are provided, there must be one value per image axis.
                        (Examples: "-laplacian 2.0,3.0,2.0" (3D image),
                        "-laplacian 2.0" (any-D image)).
  -denoise DENOISE      Non-local means adaptative denoising from P. Coupe et
                        al. as implemented in dipy. Separate with ". Example:
                        p=1,b=3
                         p: (patch radius) similar patches in the non-local
                         means are searched for locally, inside a cube of side
                         2*p+1 centered at each voxel of interest. Default: p=1
                         b: (block radius) the size of the block to be used
                         (2*b+1) in the blockwise non-local means
                         implementation. Default: b=5     Note, block radius
                         must be smaller than the smaller image dimension:
                         default value is lowered for small images)
                        To use default parameters, write -denoise 1

SIMILARITY METRIC:
  -mi <file>            Compute the mutual information (MI) between both input
                        files (-i and -mi) as in: https://scikit-learn.org/stabl
                        e/modules/generated/sklearn.metrics.mutual_info_score.ht
                        ml
  -minorm <file>        Compute the normalized mutual information (MI) between
                        both input files (-i and -mi) as in: https://scikit-lear
                        n.org/stable/modules/generated/sklearn.metrics.normalize
                        d_mutual_info_score.html
  -corr <file>          Compute the cross correlation (CC) between both input
                        files (-i and -cc).

MISC:
  -symmetrize {0,1,2}   Symmetrize data along the specified dimension.
  -type {uint8,int16,int32,float32,complex64,float64,int8,uint16,uint32,int64,uint64}
                        Output type.

sct_merge_images#

--
Spinal Cord Toolbox (6.3.dev0)

sct_merge_images -h
--

usage: sct_merge_images -i <file> [<file> ...] -d <file> -w <file> [<file> ...]
                        [-h] [-x <str>] [-o <file>] [-r {0,1}] [-v <int>]

Merge multiple source images (-i) onto destination space (-d). (All images are
warped to the destination space and then added together.)

To deal with overlap during merging (e.g. multiple input images map to the same
voxel regions in the destination space), the output voxels are divided by the
sum of the partial volume values for each image.

Specifically, the per-voxel calculation used is:
    im_out = (im_1*pv_1 + im_2*pv_2 + ...) / (pv_1 + pv_2 + ...)

So this function acts like a weighted average operator, only in destination
voxels that share multiple source voxels.

MANDATORY ARGUMENTS:
  -i <file> [<file> ...]
                        Input images
  -d <file>             Destination image
  -w <file> [<file> ...]
                        List of warping fields from input images to destination
                        image

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -x <str>              Interpolation for warping the input images to the
                        destination image. Default is linear (default: linear)
  -o <file>             Output image (default: merged_images.nii.gz)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

MISC:
  -r {0,1}              Remove temporary files. (default: 1)

sct_process_segmentation#

--
Spinal Cord Toolbox (6.3.dev0)

sct_process_segmentation -h
--

usage: sct_process_segmentation -i <file> [-h] [-o <file>] [-append <int>]
                                [-z <str>] [-perslice <int>] [-vert <str>]
                                [-vertfile <str>] [-perlevel <int>]
                                [-angle-corr <int>]
                                [-angle-corr-centerline <str>]
                                [-centerline-algo {polyfit,bspline,linear,nurbs}]
                                [-centerline-smooth <int>] [-pmj <file>]
                                [-pmj-distance <float>] [-pmj-extent <float>]
                                [-normalize <list> [<list> ...]]
                                [-normalize-PAM50 <int>] [-qc <folder>]
                                [-qc-image <str>] [-qc-dataset <str>]
                                [-qc-subject <str>] [-r <int>] [-v <int>]

Compute the following morphometric measures based on the spinal cord
segmentation:
  - area [mm^2]: Cross-sectional area, measured by counting pixels in each
    slice. Partial volume can be accounted for by inputing a mask comprising
    values within [0,1]. Can be normalized when specifying the flag -normalize
  - angle_AP, angle_RL: Estimated angle between the cord centerline and the
    axial slice. This angle is used to correct for morphometric information.
  - diameter_AP, diameter_RL: Finds the major and minor axes of the cord and
    measure their length.
  - eccentricity: Eccentricity of the ellipse that has the same second-moments
    as the spinal cord. The eccentricity is the ratio of the focal distance
    (distance between focal points) over the major axis length. The value is in
    the interval [0, 1). When it is 0, the ellipse becomes a circle.
  - orientation: angle (in degrees) between the AP axis of the spinal cord and
    the AP axis of the image
  - solidity: CSA(spinal_cord) / CSA_convex(spinal_cord). The more ellipse-
    shaped the cord is (i.e. the closer the perimeter of the cord is to being
    fully convex), the closer the solidity ratio will be to 1. This metric is
    interesting for detecting concave regions (e.g., in case of strong
    compression).
  - length: Length of the segmentation, computed by summing the slice thickness
    (corrected for the centerline angle at each slice) across the specified
    superior-inferior region.

IMPORTANT: There is a limit to the precision you can achieve for a given image
resolution. SCT does not truncate spurious digits when performing angle
correction, so please keep in mind that there may be non-significant digits in
the computed values. You may wish to compare angle-corrected values with their
corresponding uncorrected values to get a sense of the limits on precision.

To select the region to compute metrics over, choose one of the following
arguments:
   1. '-z': Select axial slices based on slice index.
   2. '-pmj' + '-pmj-distance' + '-pmj-extent': Select axial slices based on
   distance from pontomedullary junction.
      (For options 1 and 2, you can also add '-perslice' to compute metrics for
      each axial slice, rather than averaging.)
   3. '-vert' + '-vertfile': Select a region based on vertebral labels instead
   of individual slices.
      (For option 3, you can also add '-perlevel' to compute metrics for each
      vertebral level, rather than averaging.)

References:
  - '-pmj'/'-normalize':
    Bédard S, Cohen-Adad J. Automatic measure and normalization of spinal cord
    cross-sectional area using the pontomedullary junction. Frontiers in
    Neuroimaging 2022.
    https://doi.org/10.3389/fnimg.2022.1031253
  - '-normalize-PAM50':
    Valošek J, Bédard S, Keřkovský M, Rohan T, Cohen-Adad J. A database of the
    healthy human spinal cord morphometry in the PAM50 template space. Imaging
    Neuroscience 2024; 2 1–15.
    https://doi.org/10.1162/imag_a_00075

MANDATORY ARGUMENTS:
  -i <file>             Mask to compute morphometrics from. Could be binary or
                        weighted. E.g., spinal cord segmentation.Example:
                        seg.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -o <file>             Output file name (add extension). (default: csa.csv)
  -append <int>         Append results as a new line in the output csv file
                        instead of overwriting it. (default: 0)
  -z <str>              Slice range to compute the metrics across. Example: 5:23
  -perslice <int>       Set to 1 to output one metric per slice instead of a
                        single output metric. Please note that when methods ml
                        or map is used, outputing a single metric per slice and
                        then averaging them all is not the same as outputting a
                        single metric at once across all slices. (default: 0)
  -vert <str>           Vertebral levels to compute the metrics across. Example:
                        2:9 for C2 to T2. If you also specify a range of slices
                        with flag `-z`, the intersection between the specified
                        slices and vertebral levels will be considered.
  -vertfile <str>       Vertebral labeling file. Only use with flag -vert.
                        The input and the vertebral labelling file must in the
                        same voxel coordinate system and must match the
                        dimensions between each other.  (default:
                        ./label/template/PAM50_levels.nii.gz)
  -perlevel <int>       Set to 1 to output one metric per vertebral level
                        instead of a single output metric. This flag needs to be
                        used with flag -vert. (default: 0)
  -angle-corr <int>     Angle correction for computing morphometric measures.
                        When angle correction is used, the cord within the slice
                        is stretched/expanded by a factor corresponding to the
                        cosine of the angle between the centerline and the axial
                        plane. If the cord is already quasi-orthogonal to the
                        slab, you can set -angle-corr to 0. (default: 1)
  -angle-corr-centerline <str>
                        Image to be used as a centerline for computing angle
                        correction (can be either a cord segmentation or a
                        single-voxel centerline mask). This argument is
                        optional; if not provided, the centerline will be
                        derived from the input segmentation. Use this option if
                        the input segmentation is irregularly shaped (e.g.
                        gray/white matter). In such a case, it is best to pass
                        the full cord segmentation to this option, as you will
                        get a more accurate centerline (and thus a more
                        accurate, consistent angle correction).
  -centerline-algo {polyfit,bspline,linear,nurbs}
                        Algorithm for centerline fitting. Only relevant with
                        -angle-corr 1. (default: bspline)
  -centerline-smooth <int>
                        Degree of smoothing for centerline fitting. Only use
                        with -centerline-algo {bspline, linear}. (default: 30)
  -pmj <file>           Ponto-Medullary Junction (PMJ) label file. Example:
                        pmj.nii.gz
  -pmj-distance <float>
                        Distance (mm) from Ponto-Medullary Junction (PMJ) to the
                        center of the mask used to compute morphometric
                        measures. (To be used with flag '-pmj'.)
  -pmj-extent <float>   Extent (in mm) for the mask used to compute morphometric
                        measures. Each slice covered by the mask is included in
                        the calculation. (To be used with flag '-pmj' and '-pmj-
                        distance'.) (default: 20.0)
  -normalize <list> [<list> ...]
                        Normalize CSA values ('MEAN(area)').
                        Two models are available:
                            1. sex, brain-volume, thalamus-volume.
                            2. sex, brain-volume.
                        Specify each value for the subject after the
                        corresponding predictor.
                        Example:
                            -normalize sex 0 brain-volume 960606.0 thalamus-
                            volume 13942.0
                        *brain-volume and thalamus-volume are in mm^3. For sex,
                        female: 0, male: 1.
                        
                        The models were generated using T1w brain images from
                        804 healthy (non-pathological) participants ranging from
                        48 to 80 years old, taken from the UK Biobank dataset.
                        For more details on the subjects and methods used to
                        create the models, go to: https://github.com/sct-
                        pipeline/ukbiobank-spinalcord-csa#readme
                        Given the risks and lack of consensus surrounding CSA
                        normalization, we recommend thoroughly reviewing the
                        literature on this topic before applying this feature to
                        your data.
  -normalize-PAM50 <int>
                        Set to 1 to bring the metrics in the PAM50 anatomical
                        dimensions perslice. -vertfile and -perslice need to be
                        specified. (default: 0)
  -qc <folder>          The path where the quality control generated content
                        will be saved. The QC report is only available for PMJ-
                        based CSA (with flag '-pmj').
  -qc-image <str>       Input image to display in QC report. Typically, it would
                        be the source anatomical image used to generate the
                        spinal cord segmentation. This flag is mandatory if
                        using flag '-qc'.
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on.
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on.
  -r <int>              Whether to remove temporary files. 0 = no, 1 = yes
                        (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_propseg#

https://raw.githubusercontent.com/spinalcordtoolbox/doc-figures/master/command-line/sct_propseg_example.png
--
Spinal Cord Toolbox (6.3.dev0)

sct_propseg -h
--

usage: sct_propseg -i <file> -c {t1,t2,t2s,dwi} [-h] [-o <file>]
                   [-ofolder <folder>] [-down <int>] [-up <int>] [-r <int>]
                   [-v <int>] [-mesh] [-centerline-binary] [-CSF]
                   [-centerline-coord] [-cross] [-init-tube]
                   [-low-resolution-mesh] [-init-centerline <file>]
                   [-init <float>] [-init-mask <file>] [-mask-correction <file>]
                   [-rescale <float>] [-radius <float>] [-nbiter <int>]
                   [-max-area <float>] [-max-deformation <float>]
                   [-min-contrast <float>] [-d <float>]
                   [-distance-search <float>] [-alpha <float>] [-qc <folder>]
                   [-qc-dataset <str>] [-qc-subject <str>] [-correct-seg <int>]

This program segments automatically the spinal cord on T1- and T2-weighted
images, for any field of view. You must provide the type of contrast, the image
as well as the output folder path. The segmentation follows the spinal cord
centerline, which is provided by an automatic tool: Optic. The initialization of
the segmentation is made on the median slice of the centerline, and can be
ajusted using the -init parameter. The initial radius of the tubular mesh that
will be propagated should be adapted to size of the spinal cord on the initial
propagation slice.

Primary output is the binary mask of the spinal cord segmentation. This method
must provide VTK triangular mesh of the segmentation (option -mesh). Spinal cord
centerline is available as a binary image (-centerline-binary) or a text file
with coordinates in world referential (-centerline-coord).

Cross-sectional areas along the spinal cord can be available (-cross). Several
tips on segmentation correction can be found on the 'Correcting sct_propseg'
page in the Tutorials section of the documentation.

If the segmentation fails at some location (e.g. due to poor contrast between
spinal cord and CSF), edit your anatomical image (e.g. with fslview) and
manually enhance the contrast by adding bright values around the spinal cord for
T2-weighted images (dark values for T1-weighted). Then, launch the segmentation
again.

References:
  - [De Leener B, Kadoury S, Cohen-Adad J. Robust, accurate and fast automatic
  segmentation of the spinal cord. Neuroimage 98, 2014. pp 528-536. DOI:
  10.1016/j.neuroimage.2014.04.051](https://pubmed.ncbi.nlm.nih.gov/24780696/)
  - [De Leener B, Cohen-Adad J, Kadoury S. Automatic segmentation of the spinal
  cord and spinal canal coupled with vertebral labeling. IEEE Trans Med Imaging.
  2015 Aug;34(8):1705-18.](https://pubmed.ncbi.nlm.nih.gov/26011879/)

MANDATORY ARGUMENTS:
  -i <file>             Input image. Example: ti.nii.gz
  -c {t1,t2,t2s,dwi}    Type of image contrast. If your contrast is not in the
                        available options (t1, t2, t2s, dwi), use t1 (cord
                        bright / CSF dark) or t2 (cord dark / CSF bright)

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -o <file>             Output filename. Example: spinal_seg.nii.gz
  -ofolder <folder>     Output folder.
  -down <int>           Down limit of the propagation. Default is 0.
  -up <int>             Up limit of the propagation. Default is the highest
                        slice of the image.
  -r <int>              Whether to remove temporary files. 0 = no, 1 = yes
                        (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -mesh                 Output: mesh of the spinal cord segmentation (default:
                        False)
  -centerline-binary    Output: centerline as a binary image. (default: False)
  -CSF                  Output: CSF segmentation. (default: False)
  -centerline-coord     Output: centerline in world coordinates. (default:
                        False)
  -cross                Output: cross-sectional areas. (default: False)
  -init-tube            Output: initial tubular meshes. (default: False)
  -low-resolution-mesh  Output: low-resolution mesh. (default: False)
  -init-centerline <file>
                        Filename of centerline to use for the propagation. Use
                        format .txt or .nii; see file structure in
                        documentation.
                        Replace filename by 'viewer' to use interactive viewer
                        for providing centerline. Example: -init-centerline
                        viewer
  -init <float>         Axial slice where the propagation starts, default is
                        middle axial slice.
  -init-mask <file>     Mask containing three center of the spinal cord, used to
                        initiate the propagation.
                        Replace filename by 'viewer' to use interactive viewer
                        for providing mask. Example: -init-mask viewer
  -mask-correction <file>
                        mask containing binary pixels at edges of the spinal
                        cord on which the segmentation algorithm will be forced
                        to register the surface. Can be used in case of
                        poor/missing contrast between spinal cord and CSF or in
                        the presence of artefacts/pathologies.
  -rescale <float>      Rescale the image (only the header, not the data) in
                        order to enable segmentation on spinal cords with
                        dimensions different than that of humans (e.g., mice,
                        rats, elephants, etc.). For example, if the spinal cord
                        is 2x smaller than that of human, then use -rescale 2
                        (default: 1.0)
  -radius <float>       Approximate radius (in mm) of the spinal cord. Default
                        is 4.
  -nbiter <int>         Stop condition (affects only the Z propogation): number
                        of iteration for the propagation for both direction.
                        Default is 200.
  -max-area <float>     [mm^2], stop condition (affects only the Z propogation):
                        maximum cross-sectional area. Default is 120.
  -max-deformation <float>
                        [mm], stop condition (affects only the Z propogation):
                        maximum deformation per iteration. Default is 2.5
  -min-contrast <float>
                        [intensity value], stop condition (affects only the Z
                        propogation): minimum local SC/CSF contrast, default is
                        50
  -d <float>            trade-off between distance of most promising point (d is
                        high) and feature strength (d is low), default depend on
                        the contrast. Range of values from 0 to 50. 15-25 values
                        show good results. Default is 10.
  -distance-search <float>
                        maximum distance of optimal points computation along the
                        surface normals. Range of values from 0 to 30. Default
                        is 15
  -alpha <float>        Trade-off between internal (alpha is high) and external
                        (alpha is low) forces. Range of values from 0 to 50.
                        Default is 25.
  -qc <folder>          The path where the quality control generated content
                        will be saved.
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on.
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on.
  -correct-seg <int>    Enable (1) or disable (0) the algorithm that checks and
                        correct the output segmentation. More specifically, the
                        algorithm checks if the segmentation is consistent with
                        the centerline provided by isct_propseg. (default: 1)

sct_qc#

--
Spinal Cord Toolbox (6.3.dev0)

sct_qc -h
--

usage: sct_qc -i IMAGE -p
              {sct_propseg,sct_deepseg_sc,sct_deepseg_gm,sct_deepseg_lesion,sct_register_multimodal,sct_register_to_template,sct_warp_template,sct_label_vertebrae,sct_detect_pmj,sct_label_utils,sct_get_centerline,sct_fmri_moco,sct_dmri_moco,sct_image_stitch}
              [-s SEG] [-d DEST] [-plane {axial,sagittal}] [-text-labels {0,1}]
              [-qc QC] [-qc-dataset DATASET] [-qc-subject SUBJECT] [-fps float]
              [-v] [-h]

Generate Quality Control (QC) report following SCT processing.

optional arguments:
  -i IMAGE              Input image #1 (mandatory)
  -p {sct_propseg,sct_deepseg_sc,sct_deepseg_gm,sct_deepseg_lesion,sct_register_multimodal,sct_register_to_template,sct_warp_template,sct_label_vertebrae,sct_detect_pmj,sct_label_utils,sct_get_centerline,sct_fmri_moco,sct_dmri_moco,sct_image_stitch}
                        SCT function associated with the QC report to generate
  -s SEG                Input segmentation or label
  -d DEST               Input image #2 to overlay on image #1 (requires a
                        segmentation), or output of another process (e.g.,
                        sct_straighten_spinalcord)
  -plane {axial,sagittal}
                        Plane of the output QC. Only relevant for -p
                        sct_deepseg_lesion.
  -text-labels {0,1}    If set to 0, text won't be drawn on top of labels. Only
                        relevant for -p sct_label_vertebrae. (default: 1)
  -qc QC                Path to save QC report. Default: ./qc (default: ./qc)
  -qc-dataset DATASET   If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on
  -qc-subject SUBJECT   If provided, this string will be mentioned in the QC
                        report as the subject the process was run on
  -fps float            The number of frames per second for output gif images.
                        Only useful for sct_fmri_moco and sct_dmri_moco.
  -v                    Verbose (default: False)
  -h, --help            show this message and exit

Examples:
sct_qc -i t2.nii.gz -s t2_seg.nii.gz -p sct_deepseg_sc
sct_qc -i t2.nii.gz -s t2_seg_labeled.nii.gz -p sct_label_vertebrae
sct_qc -i t2.nii.gz -s t2_seg.nii.gz -p sct_deepseg_sc -qc-dataset mydata -qc-
subject sub-45
sct_qc -i t2.nii.gz -s t2_seg.nii.gz -d t2_lesion.nii.gz -p sct_deepseg_lesion
-plane axial

sct_register_multimodal#

--
Spinal Cord Toolbox (6.3.dev0)

sct_register_multimodal -h
--

usage: sct_register_multimodal -i <file> -d <file> [-h] [-iseg <file>]
                               [-dseg <file>] [-ilabel <file>] [-dlabel <file>]
                               [-initwarp <file>] [-initwarpinv <file>]
                               [-m <file>] [-o <file>] [-owarp <file>]
                               [-owarpinv <file>] [-param <list>]
                               [-identity <int>] [-z <int>]
                               [-x {nn,linear,spline}] [-ofolder <folder>]
                               [-qc <folder>] [-qc-dataset <str>]
                               [-qc-subject <str>] [-r <int>] [-v <int>]

This program co-registers two 3D volumes. The deformation is non-rigid and is
constrained along Z direction (i.e., axial plane). Hence, this function assumes
that orientation of the destination image is axial (RPI). If you need to
register two volumes with large deformations and/or different contrasts, it is
recommended to input spinal cord segmentations (binary mask) in order to achieve
maximum robustness. The program outputs a warping field that can be used to
register other images to the destination image. To apply the warping field to
another image, use 'sct_apply_transfo'

Tips:
 - For a registration step using segmentations, use the MeanSquares metric.
   Also, simple algorithm will be very efficient, for example centermass as a
   'preregistration'.
 - For a registration step using images of different contrast, use the Mutual
   Information (MI) metric.
 - Combine the steps by increasing the complexity of the transformation
   performed in each step, for example: -param
   step=1,type=seg,algo=slicereg,metric =MeanSquares:step=2,type=seg,algo=affine
   ,metric=MeanSquares,gradStep=0.2:step=3,
   type=im,algo=syn,metric=MI,iter=5,shrink=2
 - When image contrast is low, a good option is to perform registration only
   based on the image segmentation, i.e. using type=seg
 - Columnwise algorithm needs to be applied after a translation and rotation
   such as centermassrot algorithm. For example: -param
   step=1,type=seg,algo=center
   massrot,metric=MeanSquares:step=2,type=seg,algo=columnwise,metric=MeanSquares

MANDATORY ARGUMENTS:
  -i <file>             Image source. Example: src.nii.gz
  -d <file>             Image destination. Example: dest.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -iseg <file>          Segmentation source. Example: src_seg.nii.gz
  -dseg <file>          Segmentation destination. Example: dest_seg.nii.gz
  -ilabel <file>        Labels source.
  -dlabel <file>        Labels destination.
  -initwarp <file>      Initial warping field to apply to the source image.
  -initwarpinv <file>   Initial inverse warping field to apply to the
                        destination image (only use if you wish to generate the
                        dest->src warping field)
  -m <file>             Mask that can be created with sct_create_mask to improve
                        accuracy over region of interest. This mask will be used
                        on the destination image. Example: mask.nii.gz
  -o <file>             Name of output file. Example: src_reg.nii.gz
  -owarp <file>         Name of output forward warping field.
  -owarpinv <file>      Name of output inverse warping field.
  -param <list>         Parameters for registration. Separate arguments with
                        ",". Separate steps with ":".
                        Example: step=1,type=seg,algo=slicereg,metric=MeanSquare
                        s:step=2,type=im,algo=syn,metric=MI,iter=5,shrink=2
                          - step: <int> Step number (starts at 1, except for
                            type=label).
                          - type: {im, seg, imseg, label} type of data used for
                            registration. Use type=label only at step=0.
                          - algo: The algorithm used to compute the
                            transformation. Default=syn
                            * translation: translation in X-Y plane (2dof)
                            * rigid: translation + rotation in X-Y plane (4dof)
                            * affine: translation + rotation + scaling in X-Y
                              plane (6dof)
                            * syn: non-linear symmetric normalization
                            * bsplinesyn: syn regularized with b-splines
                            * slicereg: regularized translations (see:
                              goo.gl/Sj3ZeU)
                            * centermass: slicewise center of mass alignment
                              (seg only).
                            * centermassrot: slicewise center of mass and
                              rotation alignment using method specified in
                              'rot_method'
                            * columnwise: R-L scaling followed by A-P columnwise
                              alignment (seg only).
                            * dl: Contrast-agnostic, deep learning-based
                              registration based on the SynthMorph architecture.
                              Can be run using: -param step=1,type=im,algo=dl
                          - slicewise: <int> Slice-by-slice 2d transformation.
                            Default=0.
                          - metric: {CC, MI, MeanSquares}. Default=MeanSquares.
                            * CC: The cross correlation metric compares the
                              images based on their intensities but with a small
                              normalization. It can be used with images with the
                              same contrast (for ex. T2-w with T2-w). In this
                              case it is very efficient but the computation time
                              can be very long.
                            * MI: the mutual information metric compares the
                              images based on their entropy, therefore the
                              images need to be big enough to have enough
                              information. It works well for images with
                              different contrasts (for example T2-w with T1-w)
                              but not on segmentations.
                            * MeanSquares: The mean squares metric compares the
                              images based on their intensities. It can be used
                              only with images that have exactly the same
                              contrast (with the same intensity range) or with
                              segmentations.
                          - iter: <int> Number of iterations. Default=10.
                          - shrink: <int> Shrink factor. A shrink factor of 2
                            will down sample the images by a factor of 2 to do
                            the registration, and thus allow bigger deformations
                            (and be faster to compute). It is usually combined
                            with a smoothing. (only for syn/bsplinesyn).
                            Default=1.
                          - smooth: <int> Smooth factor (in mm). Note: if
                            algo={centermassrot,columnwise} the smoothing kernel
                            is: SxSx0. Otherwise it is SxSxS. Default=0.
                          - laplacian: <int> Laplace filter using Gaussian
                            second derivatives, applied before registration. The
                            input number correspond to the standard deviation of
                            the Gaussian filter. Default=0.
                          - gradStep: <float> The gradient step used by the
                            function opitmizer. A small gradient step can lead
                            to a more accurate registration but will take longer
                            to compute, with the risk to not reach convergence.
                            A bigger gradient step will make the registration
                            faster but the result can be far from an optimum.
                            Default=0.5.
                          - deformation: ?x?x?: Restrict deformation (for ANTs
                            algo). Replace ? by 0 (no deformation) or 1
                            (deformation). Default=1x1x0.
                          - init: Initial translation alignment based on:
                            * geometric: Geometric center of images
                            * centermass: Center of mass of images
                            * origin: Physical origin of images
                          - poly: <int> Polynomial degree of regularization
                            (only for algo=slicereg). Default=5.
                          - filter_size: <float> Filter size for regularization
                            (only for algo=centermassrot). Default=5.
                          - smoothWarpXY: <int> Smooth XY warping field (only
                            for algo=columnwize). Default=2.
                          - pca_eigenratio_th: <int> Min ratio between the two
                            eigenvalues for PCA-based angular adjustment (only
                            for algo=centermassrot and rot_method=pca).
                            Default=1.6.
                          - dof: <str> Degree of freedom for type=label.
                            Separate with '_'. Default=Tx_Ty_Tz_Rx_Ry_Rz. T
                            stands for translation, R stands for rotation, and S
                            stands for scaling. x, y, and z indicate the
                            direction. Examples:
                            * Tx_Ty_Tz_Rx_Ry_Rz would allow translation on x, y
                              and z axes and rotation on x, y and z axes
                            * Tx_Ty_Tz_Sz would allow translation on x, y and z
                              axes and scaling only on z axis
                          - rot_method {pca, hog, pcahog}: rotation method to be
                            used with algo=centermassrot. If using hog or
                            pcahog, type should be set to imseg. Default=pca
                            * pca: approximate cord segmentation by an ellipse
                              and finds it orientation using PCA's eigenvectors
                            * hog: finds the orientation using the symmetry of
                              the image
                            * pcahog: tries method pca and if it fails, uses
                              method hog.
  -identity <int>       Supplying this option will skip registration
                        optimization (e.g. translations, rotations,
                        deformations) and will only rely on the qform (from the
                        NIfTI header) of the source and destination images. Use
                        this option if you wish to put the source image into the
                        space of the destination image (i.e. match dimension,
                        resolution and orientation). (default: 0)
  -z <int>              Size of z-padding to enable deformation at edges when
                        using SyN. (default: 5)
  -x {nn,linear,spline}
                        Final interpolation. (default: linear)
  -ofolder <folder>     Output folder. Example: reg_results
  -qc <folder>          The path where the quality control generated content
                        will be saved. Note: This flag requires the '-dseg'
                        flag.
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on.
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on.
  -r <int>              Whether to remove temporary files. 0 = no, 1 = yes
                        (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_register_to_template#

--
Spinal Cord Toolbox (6.3.dev0)

sct_register_to_template -h
--

usage: sct_register_to_template -i <file> -s <file> [-h] [-s-template-id <int>]
                                [-l <file>] [-ldisc <file>] [-lspinal <file>]
                                [-ofolder <folder>] [-t <folder>]
                                [-c {t1,t2,t2s}] [-ref {template,subject}]
                                [-param <list>]
                                [-centerline-algo {polyfit,bspline,linear,nurbs}]
                                [-centerline-smooth <int>] [-qc <folder>]
                                [-qc-dataset <str>] [-qc-subject <str>]
                                [-r <int>] [-v <int>]

Register an anatomical image to the spinal cord MRI template (default: PAM50).

The registration process includes three main registration steps:
  1. straightening of the image using the spinal cord segmentation (see
  sct_straighten_spinalcord for details);
  2. vertebral alignment between the image and the template, using labels along
  the spine;
  3. iterative slice-wise non-linear registration (see sct_register_multimodal
  for details)

To register a subject to the template, try the default command:
  sct_register_to_template -i data.nii.gz -s data_seg.nii.gz -l
  data_labels.nii.gz

If this default command does not produce satisfactory results, the '-param'
argument should be tweaked according to the tips given here:
  https://spinalcordtoolbox.com/en/latest/user_section/command-line.html#sct-
  register-multimodal

The default registration method brings the subject image to the template, which
can be problematic with highly non-isotropic images as it would induce large
interpolation errors during the straightening procedure. Although the default
method is recommended, you may want to register the template to the subject
(instead of the subject to the template) by skipping the straightening
procedure. To do so, use the parameter '-ref subject'. Example below:
  sct_register_to_template -i data.nii.gz -s data_seg.nii.gz -l
  data_labels.nii.gz -ref subject -param
  step=1,type=seg,algo=centermassrot,smooth
  =0:step=2,type=seg,algo=columnwise,smooth=0,smoothWarpXY=2

Vertebral alignment (step 2) consists in aligning the vertebrae between the
subject and the template. Two types of labels are possible:
  - Vertebrae mid-body labels, created at the center of the spinal cord using
    the parameter '-l';
  - Posterior edge of the intervertebral discs, using the parameter '-ldisc'.

If only one label is provided, a simple translation will be applied between the
subject label and the template label. No scaling will be performed.

If two labels are provided, a linear transformation (translation + rotation +
superior-inferior linear scaling) will be applied. The strategy here is to
define labels that cover the region of interest. For example, if you are
interested in studying C2 to C6 levels, then provide one label at C2 and another
at C6. However, note that if the two labels are very far apart (e.g. C2 and
T12), there might be a mis-alignment of discs because a subject's intervertebral
discs distance might differ from that of the template.

If more than two labels are used, a non-linear registration will be applied to
align the each intervertebral disc between the subject and the template, as
described in sct_straighten_spinalcord. This the most accurate method, however
it has some serious caveats:
  - This feature is not compatible with the parameter '-ref subject', where only
    a rigid registration is performed.
  - Due to the non-linear registration in the S-I direction, the warping field
    will be cropped above the top label and below the bottom label. Applying
    this warping field will result in a strange-looking registered image that
    has the same value above the top label and below the bottom label. But if
    you are not interested in these regions, you do not need to worry about it.

We recommend starting with 2 labels, then trying the other options on a case-by-
case basis depending on your data.

More information about label creation can be found at
https://spinalcordtoolbox.com/user_section/tutorials/vertebral-labeling.html

MANDATORY ARGUMENTS:
  -i <file>             Input anatomical image. Example: anat.nii.gz
  -s <file>             Spinal cord segmentation. Example: anat_seg.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -s-template-id <int>  Segmentation file ID to use for registration. The ID is
                        an integer indicated in the file
                        'template/info_label.txt'. This 'info_label.txt' file
                        corresponds to the template indicated by the flag '-t'.
                        By default, the spinal cord segmentation is used (ID=3),
                        but if available, a different segmentation such as white
                        matter segmentation could produce better registration
                        results. (default: 3)
  -l <file>             One or two labels (preferred) located at the center of
                        the spinal cord, on the mid-vertebral slice. Example:
                        anat_labels.nii.gz
                        For more information about label creation, please see: h
                        ttps://spinalcordtoolbox.com/user_section/tutorials/vert
                        ebral-labeling.html
  -ldisc <file>         File containing disc labels. Labels can be located
                        either at the posterior edge of the intervertebral
                        discs, or at the orthogonal projection of each disc onto
                        the spinal cord (e.g.: the file
                        'xxx_seg_labeled_discs.nii.gz' output by
                        sct_label_vertebrae).
                        If you are using more than 2 labels, all discs covering
                        the region of interest should be provided. E.g., if you
                        are interested in levels C2 to C7, then you should
                        provide disc labels 2,3,4,5,6,7. For more information
                        about label creation, please refer to https://spinalcord
                        toolbox.com/user_section/tutorials/vertebral-
                        labeling.html
  -lspinal <file>       Labels located in the center of the spinal cord, at the
                        superior-inferior level corresponding to the mid-point
                        of the spinal level. Example: anat_labels.nii.gz
                        Each label is a single voxel, which value corresponds to
                        the spinal level (e.g.: 2 for spinal level 2). If you
                        are using more than 2 labels, all spinal levels covering
                        the region of interest should be provided (e.g., if you
                        are interested in levels C2 to C7, then you should
                        provide spinal level labels 2,3,4,5,6,7).
  -ofolder <folder>     Output folder.
  -t <folder>           Path to template (default: /home/docs/checkouts/readthed
                        ocs.org/user_builds/spinalcordtoolbox/envs/latest/lib/py
                        thon3.9/site-packages/data/PAM50)
  -c {t1,t2,t2s}        Contrast to use for registration. (default: t2)
  -ref {template,subject}
                        Reference for registration: template: subject->template,
                        subject: template->subject. (default: template)
  -param <list>         Parameters for registration (see
                        sct_register_multimodal). Default:
                        step=0
                          - type=label
                          - dof=Tx_Ty_Tz_Sz
                        
                        step=1
                          - type=imseg
                          - algo=centermassrot
                          - metric=MeanSquares
                          - iter=10
                          - smooth=0
                          - gradStep=0.5
                          - slicewise=0
                          - smoothWarpXY=2
                          - pca_eigenratio_th=1.6
                        
                        step=2
                          - type=seg
                          - algo=bsplinesyn
                          - metric=MeanSquares
                          - iter=3
                          - smooth=1
                          - gradStep=0.5
                          - slicewise=0
                          - smoothWarpXY=2
                          - pca_eigenratio_th=1.6
  -centerline-algo {polyfit,bspline,linear,nurbs}
                        Algorithm for centerline fitting (when straightening the
                        spinal cord). (default: bspline)
  -centerline-smooth <int>
                        Degree of smoothing for centerline fitting. Only use
                        with -centerline-algo {bspline, linear}. (default: 20)
  -qc <folder>          The path where the quality control generated content
                        will be saved.
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on.
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on.
  -r <int>              Whether to remove temporary files. 0 = no, 1 = yes
                        (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_resample#

--
Spinal Cord Toolbox (6.3.dev0)

sct_resample -h
--

usage: sct_resample -i <file> [-f <str>] [-mm <str>] [-vox <str>] [-ref <file>]
                    [-h] [-x {nn,linear,spline}] [-o <file>] [-v <int>]

Anisotropic resampling of 3D or 4D data.

MANDATORY ARGUMENTS:
  -i <file>             Image to resample. Can be 3D or 4D. (Cannot be 2D)
                        Example: dwi.nii.gz

METHOD TO SPECIFY NEW SIZE:
Please choose only one of the 4 options:
  -f <str>              Resampling factor in each dimensions (x,y,z). Separate
                        with 'x'. Example: 0.5x0.5x1
                        For 2x upsampling, set to 2. For 2x downsampling set to
                        0.5
  -mm <str>             New resolution in mm. Separate dimension with 'x'.
                        Example: 0.1x0.1x5
                        Note: Resampling can only approximate a desired `mm`
                        resolution, given the limitations of discrete voxel data
                        arrays.
  -vox <str>            Resampling size in number of voxels in each dimensions
                        (x,y,z). Separate with 'x'.
  -ref <file>           Reference image to resample input image to. The voxel
                        dimensions and affine of the reference image will be
                        used.

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -x {nn,linear,spline}
                        Interpolation method. (default: linear)
  -o <file>             Output file name. Example: dwi_resampled.nii.gz
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_run_batch#

--
Spinal Cord Toolbox (6.3.dev0)

sct_run_batch -h
--

usage: sct_run_batch [-config CONFIG] [-jobs <int>] [-itk-threads <int>]
                     [-path-data PATH_DATA] [-subject-prefix SUBJECT_PREFIX]
                     [-path-output PATH_OUTPUT] [-batch-log BATCH_LOG]
                     [-include INCLUDE]
                     [-include-list INCLUDE_LIST [INCLUDE_LIST ...]]
                     [-exclude EXCLUDE]
                     [-exclude-list EXCLUDE_LIST [EXCLUDE_LIST ...]]
                     [-ignore-ses] [-path-segmanual PATH_SEGMANUAL]
                     [-script-args SCRIPT_ARGS] [-email-to EMAIL_TO]
                     [-email-from EMAIL_FROM] [-email-host EMAIL_HOST]
                     [-continue-on-error {0,1}] [-script SCRIPT] [-zip]
                     [-v <int>] [-h]

Wrapper to processing scripts, which loops across subjects. Subjects should be
organized as folders within a single directory. We recommend following the BIDS
convention (https://bids.neuroimaging.io/). The processing script should accept
a subject directory as its only argument. Additional information is passed via
environment variables and the arguments passed via `-script-args`. If the script
or the input data are located within a git repository, the git commit is
displayed. If the script or data have changed since the latest commit, the
symbol "*" is added after the git commit number. If no git repository is found,
the git commit version displays "?!?". The script is copied on the output folder
(-path-out).

optional arguments:
  -config CONFIG, -c CONFIG
                        A json (.json) or yaml (.yml|.yaml) file with arguments.
                        All arguments to the configuration file are the same as
                        the command line arguments, except all dashes (-) are
                        replaced with underscores (_). Using command line flags
                        can be used to override arguments provided in the
                        configuration file, but this is discouraged. Please note
                        that while quotes are optional for strings in YAML
                        omitting them may cause parse errors.
                        Note that for the 'exclude_list' (or 'include_list')
                        argument you can exclude/include entire subjects or
                        individual sessions; see examples below.
                        
                        Example YAML configuration:
                        path_data   : "~/sct_data"
                        path_output : "~/pipeline_results"
                        script      : "nature_paper_analysis.sh"
                        jobs        : -1
                        exclude_list : ["sub-01/ses-01", "sub-02", "ses-03"]
                        # this will exclude ses-01 for sub-01, all sessions for
                        sub-02 and ses-03 for all subjects
                        
                        Example JSON configuration:
                        {
                        "path_data"   : "~/sct_data",
                        "path_output" : "~/pipeline_results",
                        "script"      : "nature_paper_analysis.sh",
                        "jobs"        : -1,
                        "exclude_list" : ["sub-01/ses-01", "sub-02", "ses-03"]
                        }
  -jobs <int>           The number of jobs to run in parallel. Either an integer
                        greater than or equal to one specifying the number of
                        cores, 0 or a negative integer specifying number of
                        cores minus that number. For example '-jobs -1' will run
                        with all the available cores minus one job in parallel.
                        Set '-jobs 0' to use all available cores.
                        This argument enables process-based parallelism, while
                        '-itk-threads' enables thread-based parallelism. You may
                        need to tweak both to find a balance that works best for
                        your system. (default: 1)
  -itk-threads <int>    Sets the environment variable
                        "ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS".
                        Number of threads to use for ITK based programs
                        including ANTs. Increasing this can provide a
                        performance boost for high-performance (multi-core)
                        computing environments. However, increasing the number
                        of threads may also result in a large increase in
                        memory.
                        This argument enables thread-based parallelism, while
                        '-jobs' enables process-based parallelism. You may need
                        to tweak both to find a balance that works best for your
                        system. (default: 1)
  -path-data PATH_DATA  Setting for environment variable: PATH_DATA
                        Path containing subject directories in a consistent
                        format
  -subject-prefix SUBJECT_PREFIX
                        Subject prefix, defaults to "sub-" which is the prefix
                        used for BIDS directories. If the subject directories do
                        not share a common prefix, an empty string can be passed
                        here. (default: sub-)
  -path-output PATH_OUTPUT
                        Base directory for environment variables:
                        PATH_DATA_PROCESSED=<path-output>/data_processed
                        PATH_RESULTS=<path-output>/results
                        PATH_QC=<path-output>/qc
                        PATH_LOG=<path-output>/log
                        Which are respectively output paths for the processed
                        data, results, quality control (QC) and logs (default:
                        .)
  -batch-log BATCH_LOG  A log file for all terminal output produced by this
                        script (not necessarily including the individual job
                        outputs. File will be relative to "<path-output>/log".
                        (default: sct_run_batch_log.txt)
  -include INCLUDE      Optional regex used to filter the list of subject
                        directories. Only process a subject if they match the
                        regex. Inclusions are processed before exclusions.
                        Cannot be used with `include-list`.
  -include-list INCLUDE_LIST [INCLUDE_LIST ...]
                        Optional space separated list of subjects or sessions to
                        include. Only process subjects or sessions if they are
                        on this list. Inclusions are processed before
                        exclusions. Cannot be used with `include`. You can
                        combine subjects and sessions; see examples.
                        Examples: '-include-list sub-001 sub-002' or '-include-
                        list sub-001/ses-01 ses-02'
  -exclude EXCLUDE      Optional regex used to filter the list of subject
                        directories. Only process a subject if they do not match
                        the regex. Exclusions are processed after inclusions.
                        Cannot be used with `exclude-list`
  -exclude-list EXCLUDE_LIST [EXCLUDE_LIST ...]
                        Optional space separated list of subjects or sessions to
                        exclude. Only process subjects or sessions if they are
                        not on this list. Inclusions are processed before
                        exclusions. Cannot be used with `exclude`. You can
                        combine subjects and sessions; see examples.
                        Examples: '-exclude-list sub-003 sub-004' or '-exclude-
                        list sub-003/ses-01 ses-02'
  -ignore-ses           By default, if 'ses' subfolders are present, then
                        'sct_run_batch' will run the script within each
                        individual 'ses' subfolder. Passing `-ignore-ses` will
                        change the behavior so that 'sct_run_batch' will not go
                        into each 'ses' folder. Instead, it will run the script
                        on just the top-level subject folders. (default: False)
  -path-segmanual PATH_SEGMANUAL
                        Setting for environment variable: PATH_SEGMANUAL
                        A path containing manual segmentations to be used by the
                        script program. (default: .)
  -script-args SCRIPT_ARGS
                        A quoted string with extra arguments to pass to the
                        script.
                        For example 'sct_run_batch -path-data data/ -script
                        process_data.sh -script-args "ARG1 ARG2"'.
                        The arguments are retrieved by a script as '${2}',
                        '${3}', etc.
                        Note: '${1}' is reserved for the subject folder name,
                        which is retrieved automatically.
                        Note: Do not use '~' in the path. Use '${HOME}' instead.
  -email-to EMAIL_TO    Optional email address where sct_run_batch can send an
                        alert on completion of the batch processing.
  -email-from EMAIL_FROM
                        Optional alternative email to use to send the email.
                        Defaults to the same address as `-email-to`
  -email-host EMAIL_HOST
                        Optional smtp server and port to use to send the email.
                        Defaults to gmail's server. Note that gmail server
                        requires "Less secure apps access" to be turned on,
                        which can be done  at
                        https://myaccount.google.com/security (default:
                        smtp.gmail.com:587)
  -continue-on-error {0,1}
                        Whether the batch processing should continue if a
                        subject fails. (default: 1)
  -script SCRIPT        Shell script used to process the data.
  -zip                  Create zip archive of output folders log/, qc/ and
                        results/. (default: False)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)
  -h, --help            show this help message and exit

sct_smooth_spinalcord#

--
Spinal Cord Toolbox (6.3.dev0)

sct_smooth_spinalcord -h
--

usage: sct_smooth_spinalcord -i <file> -s <file> [-h] [-smooth <list>]
                             [-algo-fitting <str>] [-o <file>] [-r {0,1}]
                             [-v <int>]

Smooth the spinal cord along its centerline. Steps are:
  1) Spinal cord is straightened (using centerline),
  2) a Gaussian kernel is applied in the superior-inferior direction,
  3) then cord is de-straightened as originally.

MANDATORY ARGUMENTS:
  -i <file>            Image to smooth. Example: data.nii.gz
  -s <file>            Spinal cord centerline or segmentation. Example:
                       data_centerline.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help           Show this help message and exit.
  -smooth <list>       Sigma (standard deviation) of the smoothing Gaussian
                       kernel (in mm). For isotropic smoothing you only need to
                       specify a value (e.g. 2). For anisotropic smoothing
                       specify a value for each axis, separated with a comma.
                       The order should follow axes Right-Left, Antero-
                       Posterior, Superior-Inferior (e.g.: 1,1,3). For no
                       smoothing, set value to 0. (default: [0, 0, 3])
  -algo-fitting <str>  Algorithm for curve fitting. For more information, see
                       sct_straighten_spinalcord. (default: bspline)
  -o <file>            Output filename. Example: smooth_sc.nii.gz. By default,
                       the suffix '_smooth' will be added to the input file
                       name.
  -r {0,1}             Whether to remove temporary files. 0 = no, 1 = yes
                       (default: 1)
  -v <int>             Verbosity. 0: Display only errors/warnings, 1:
                       Errors/warnings + info messages, 2: Debug mode (default:
                       1)

sct_straighten_spinalcord#

--
Spinal Cord Toolbox (6.3.dev0)

sct_straighten_spinalcord -h
--

usage: sct_straighten_spinalcord -i <file> -s <file> [-h] [-dest <file>]
                                 [-ldisc-input <file>] [-ldisc-dest <file>]
                                 [-disable-straight2curved]
                                 [-disable-curved2straight]
                                 [-speed-factor <float>] [-xy-size <float>]
                                 [-o <file>] [-ofolder <folder>]
                                 [-centerline-algo {bspline,linear,nurbs}]
                                 [-centerline-smooth <int>] [-param <list>]
                                 [-x {nn,linear,spline}] [-qc <str>]
                                 [-qc-dataset <str>] [-qc-subject <str>]
                                 [-r {0,1}] [-v <int>]

This program takes as input an anatomic image and the spinal cord centerline (or
segmentation), and returns the an image of a straightened spinal cord.
Reference: De Leener B, Mangeat G, Dupont S, Martin AR, Callot V, Stikov N,
Fehlings MG, Cohen-Adad J. Topologically-preserving straightening of spinal cord
MRI. J Magn Reson Imaging. 2017 Oct;46(4):1209-1219

MANDATORY ARGUMENTS:
  -i <file>             Input image with curved spinal cord. Example:
                        "t2.nii.gz"
  -s <file>             Spinal cord centerline (or segmentation) of the input
                        image. To obtain the centerline, you can use
                        sct_get_centerline. To obtain the segmentation you can
                        use sct_propseg or sct_deepseg_sc. Example:
                        centerline.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit
  -dest <file>          Spinal cord centerline (or segmentation) of a
                        destination image (which could be straight or curved).
                        An algorithm scales the length of the input centerline
                        to match that of the destination centerline. If using
                        -ldisc-input and -ldisc-dest with this parameter,
                        instead of linear scaling, the source centerline will be
                        non-linearly matched so that the inter-vertebral discs
                        of the input image will match that of the destination
                        image. This feature is particularly useful for
                        registering to a template while accounting for disc
                        alignment.
  -ldisc-input <file>   Labels located at the posterior edge of the
                        intervertebral discs, for the input  image (-i). All
                        disc covering the region of interest should be provided.
                        Exmaple: if you are interested in levels C2 to C7, then
                        you should provide disc labels 2,3,4,5,6,7). More
                        details about label creation at https://spinalcordtoolbo
                        x.com/user_section/tutorials/vertebral-labeling.html.
                        This option must be used with the -ldisc-dest parameter.
  -ldisc-dest <file>    Labels located at the posterior edge of the
                        intervertebral discs, for the destination file (-dest).
                        The same comments as in -ldisc-input apply. This option
                        must be used with the -ldisc-input parameter.
  -disable-straight2curved
                        Disable straight to curved transformation computation,
                        in case you do not need the output warping field
                        straight-->curve (faster). (default: False)
  -disable-curved2straight
                        Disable curved to straight transformation computation,
                        in case you do not need the output warping field
                        curve-->straight (faster). (default: False)
  -speed-factor <float>
                        Acceleration factor for the calculation of the
                        straightening warping field. This speed factor enables
                        an intermediate resampling to a lower resolution, which
                        decreases the computational time at the cost of lower
                        accuracy. A speed factor of 2 means that the input image
                        will be downsampled by a factor 2 before calculating the
                        straightening warping field. For example, a 1x1x1 mm^3
                        image will be downsampled to 2x2x2 mm3, providing a
                        speed factor of approximately 8. Note that accelerating
                        the straightening process reduces the precision of the
                        algorithm, and induces undesirable edges effects.
                        Default=1 (no downsampling). (default: 1)
  -xy-size <float>      Size of the output FOV in the RL/AP plane, in mm. The
                        resolution of the destination image is the same as that
                        of the source image (-i). Default: 35. (default: 35.0)
  -o <file>             Straightened file. By default, the suffix "_straight"
                        will be added to the input file name.
  -ofolder <folder>     Output folder (all outputs will go there). (default: .)
  -centerline-algo {bspline,linear,nurbs}
                        Algorithm for centerline fitting. Default: nurbs.
                        (default: nurbs)
  -centerline-smooth <int>
                        Degree of smoothing for centerline fitting. Only use
                        with -centerline-algo {bspline, linear}. Default: 10
                        (default: 10)
  -param <list>         Parameters for spinal cord straightening. Separate
                        arguments with ",".
                          - precision: Float [1, inf) Precision factor of
                            straightening, related to the number of slices.
                            Increasing this parameter increases the precision
                            along with increased computational time. Not taken
                            into account with Hanning fitting method. Default=2
                          - threshold_distance: Float [0, inf) Threshold at
                            which voxels are not considered into displacement.
                            Increase this threshold if the image is blackout
                            around the spinal cord too much. Default=10
                          - accuracy_results: {0, 1} Disable/Enable computation
                            of accuracy results after straightening. Default=0
                          - template_orientation: {0, 1} Disable/Enable
                            orientation of the straight image to be the same as
                            the template. Default=0
  -x {nn,linear,spline}
                        Final interpolation. Default: spline. (default: spline)
  -qc <str>             The path where the quality control generated content
                        will be saved
  -qc-dataset <str>     If provided, this string will be mentioned in the QC
                        report as the dataset the process was run on
  -qc-subject <str>     If provided, this string will be mentioned in the QC
                        report as the subject the process was run on
  -r {0,1}              Remove temporary files. (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_warp_template#

--
Spinal Cord Toolbox (6.3.dev0)

sct_warp_template -h
--

usage: sct_warp_template -d <file> -w <file> [-h] [-a <int>] [-s <int>]
                         [-ofolder <folder>] [-t <folder>] [-qc <folder>]
                         [-qc-dataset <str>] [-qc-subject <str>] [-v <int>]
                         [-histo <int>]

This function warps the template and all atlases to a destination image.

MANDATORY ARGUMENTS:
  -d <file>          Destination image the template will be warped to. Example:
                     dwi_mean.nii.gz
  -w <file>          Warping field. Example: warp_template2dmri.nii.gz

OPTIONAL ARGUMENTS:
  -h, --help         Show this help message and exit.
  -a <int>           Warp atlas of white matter. (default: 1)
  -s <int>           Warp spinal levels. DEPRECATED: As of SCT v6.1,
                     probabilistic spinal levels have been replaced with a
                     single integer spinal level file, which can be found inside
                     of the warped 'template/' folder. The '-s' option is no
                     longer needed.
                     
                     For more information on the rationale behind this decision,
                     please refer to:
                       - https://github.com/spinalcordtoolbox/PAM50/issues/16
                       - https://forum.spinalcordmri.org/t/updating-spinal-
                         levels-feedback-needed/1136
                      (default: 0)
  -ofolder <folder>  Name of output folder. (default: label)
  -t <folder>        Path to template. (default: /home/docs/checkouts/readthedoc
                     s.org/user_builds/spinalcordtoolbox/envs/latest/lib/python3
                     .9/site-packages/data/PAM50)
  -qc <folder>       The path where the quality control generated content will
                     be saved.
  -qc-dataset <str>  If provided, this string will be mentioned in the QC report
                     as the dataset the process was run on.
  -qc-subject <str>  If provided, this string will be mentioned in the QC report
                     as the subject the process was run on.
  -v <int>           Verbosity. 0: Display only errors/warnings, 1:
                     Errors/warnings + info messages, 2: Debug mode (default: 1)
  -histo <int>       Warp histology atlas from Duval et al. Neuroimage 2019
                     (https://pubmed.ncbi.nlm.nih.gov/30326296/). (default: 0)

System Commands#

sct_check_dependencies#

--
Spinal Cord Toolbox (6.3.dev0)

sct_check_dependencies -h
--

usage: sct_check_dependencies [-h] [-complete] [-short]

Check the installation and environment variables of the toolbox and its
dependencies.

OPTIONAL ARGUMENTS:
  -h, --help  Show this help message and exit
  -complete   Complete test. (default: False)
  -short      Short test. Only shows SCT version, CPU cores and RAM available.
              (default: False)

sct_version#

6.3.dev0