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 (dev)

sct_analyze_lesion -h
--

usage: sct_analyze_lesion -m <file> -s <file> [-h] [-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.

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").
  -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')

OPTIONAL ARGUMENTS:
  -h, --help         show this help message and exit
  -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 eachregion 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 (dev)

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>] [-igt <str>] [-r {0,1}]
                           [-v <int>]

Extraction of grey 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: http://scikit-image.org/docs/dev/api/skimage.feature.html#greycoprops. 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/)
  -igt <str>         File name of ground-truth texture metrics.
  -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 (dev)

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 (dev)

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
  -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 (dev)

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_mscc

--
Spinal Cord Toolbox (dev)

sct_compute_mscc -h
--

usage: sct_compute_mscc -di <float> -da <float> -db <float> [-h] [-v <int>]

Compute Maximum Spinal Cord Compression (MSCC) as in: 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.

MANDATORY ARGUMENTS:
  -di <float>  Anteroposterior cord distance (in mm) at the level of maximum
               injury. Example: 6.85
  -da <float>  Anteroposterior cord distance (in mm) at the nearest normal level
               above the level of injury.
  -db <float>  Anteroposterior cord distance (in mm) at the nearest normal level
               below the level of injury.

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_compute_mtr

--
Spinal Cord Toolbox (dev)

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 imagerange 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 (dev)

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 ms] for mt image. By default, will be fetch from the
                 json sidecar (if it exists).
  -trpd <float>  TR [in ms] for pd image. By default, will be fetch from the
                 json sidecar (if it exists).
  -trt1 <float>  TR [in ms] for t1 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 (dev)

sct_compute_snr -h
--

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

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>            4D data to compute the SNR on (along the 4th dimension).
                       Example: b0s.nii.gz

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
  -method {diff,mult}  Method to use to compute the SNR:
                        diff (default): Substract two volumes (defined by -vol)
                        and estimate noise variance within the ROI (flag -m is
                        required).
                        mult: Estimate noise variance over time across volumes
                        specified with -vol. (default: diff)
  -vol <str>           Volumes to compute SNR from. Separate with "," (Example:
                       -vol 0,1), or select range using ":" (Example: -vol
                       2:50). By default, all volumes in series are selected.
  -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_convert

--
Spinal Cord Toolbox (dev)

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 (dev)

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>           Size of the mask in the axial plane, given in pixel
                        (Example: 35) or in millimeter (Example: 35mm). If
                        shape=gaussian, size 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 (dev)

sct_crop_image -h
--

usage: sct_crop_image -i <file> [-h] [-o <str>] [-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.
  -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

sct_deepseg

--
Spinal Cord Toolbox (dev)

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_tumor-edema-cavity_t1-t2,seg_mice_gm-wm_dwi}]
                   [-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,suffix
                        '_seg' 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 that can be achieved. (default:
                        False)
  -install-task {seg_sc_t2star,seg_mice_sc,seg_mice_gm,seg_tumor_t2,seg_tumor-edema-cavity_t1-t2,seg_mice_gm-wm_dwi}
                        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

sct_deepseg_gm

--
Spinal Cord Toolbox (dev)

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 (dev)

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>] [-igt <str>]

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

MANDATORY ARGUMENTS:
  -i <file>             Input image. Example: t1.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
                        manual). 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: /hom
                        e/docs/checkouts/readthedocs.org/user_builds/spinalcordt
                        oolbox/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)
  -igt <str>            File name of ground-truth segmentation.

sct_deepseg_sc

--
Spinal Cord Toolbox (dev)

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>] [-igt <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 wasestimated 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".
  -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
  -igt <str>            File name of ground-truth segmentation.

sct_denoising_onlm

--
Spinal Cord Toolbox (dev)

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.)

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 (dev)

sct_detect_pmj -h
--

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

Detection of the Ponto-Medullary Junction (PMJ).  This method is machine-learning based and adapted for T1w-like or  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.
  -igt <str>         File name of ground-truth PMJ (single voxel).
  -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 (dev)

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 (dev)

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 (dev)

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 (dev)

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 (dev)

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_display_bvecs

--
Spinal Cord Toolbox (dev)

sct_dmri_display_bvecs -h
--

usage: sct_dmri_display_bvecs -bvec <file> [-h]

Display scatter plot of gradient directions from bvecs file.

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

OPTIONAL ARGUMENTS:
  -h, --help    Show this help message and exit.

sct_dmri_moco

--
Spinal Cord Toolbox (dev)

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

Motion correction of dMRI data. Some of the features to improve robustness were proposed in Xu et al. (http://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

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.nii.gz
  -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)

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 (dev)

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.nii.gz
  -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 (dev)

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 (dev)

sct_download_data -h
--

usage: sct_download_data -d
                         {sct_example_data,sct_testing_data,PAM50,MNI-Poly-AMU,gm_model,optic_models,pmj_models,binaries_linux,binaries_osx,course_hawaii17,course_paris18,course_london19,course_beijing19,deepseg_gm_models,deepseg_sc_models,deepseg_lesion_models,c2c3_disc_models}
                         [-h] [-o <folder>] [-k] [-v <int>]

Download binaries from the web.

MANDATORY ARGUMENTS:
  -d {sct_example_data,sct_testing_data,PAM50,MNI-Poly-AMU,gm_model,optic_models,pmj_models,binaries_linux,binaries_osx,course_hawaii17,course_paris18,course_london19,course_beijing19,deepseg_gm_models,deepseg_sc_models,deepseg_lesion_models,c2c3_disc_models}
                        Name of the dataset.

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -o <folder>           Path to a directory to save the downloaded data.
                        (Defaults to ./${dataset-name}. 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)

sct_extract_metric

--
Spinal Cord Toolbox (dev)

sct_extract_metric -h
--

usage: sct_extract_metric -i <file> [-h] [-f <folder>] [-l <str>] [-list-labels]
                          [-method {ml,map,wa,bin,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/use
                        r_builds/spinalcordtoolbox/envs/latest/lib/python3.6/sit
                        e-packages/data/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,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)
                          - 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 estimate the metric across. Example:
                        2:9 (for C2 to T2)
  -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 (dev)

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 (dev)

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 (dev)

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

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 the slice-wise average of the motion correction for XY (one file), 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. O = no, 1 = yes (default: 1)
  -v <int>              Verbosity. 0: Display only errors/warnings, 1:
                        Errors/warnings + info messages, 2: Debug mode (default:
                        1)

sct_get_centerline

--
Spinal Cord Toolbox (dev)

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>] [-o <file>] [-gap <float>]
                          [-igt <file>] [-v <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. It will interpolate if
                          slices are missing and 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)
  -o <file>             File name (without extension) for the centerline output
                        files. By default, output file will be the input with
                        suffix '_centerline'. Example: 'centerline_optic'
  -gap <float>          Gap in mm between manually selected points. Only with
                        method=viewer. (default: 20.0)
  -igt <file>           File name of ground-truth centerline or segmentation
                        (binary nifti).
  -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_image

--
Spinal Cord Toolbox (dev)

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}]
                 [-remove-vol <list>] [-keep-vol <list>]
                 [-type {uint8,int16,int32,float32,complex64,float64,int8,uint16,uint32,int64,uint64}]
                 [-copy-header <file>] [-set-sform-to-qform] [-getorient]
                 [-setorient {RIP,LIP,RSP,LSP,RIA,LIA,RSA,LSA,IRP,ILP,SRP,SLP,IRA,ILA,SRA,SLA,RPI,LPI,RAI,LAI,RPS,LPS,RAS,LAS,PRI,PLI,ARI,ALI,PRS,PLS,ARS,ALS,IPR,SPR,IAR,SAR,IPL,SPL,IAL,SAL,PIR,PSR,AIR,ASR,PIL,PSL,AIL,ASL}]
                 [-setorient-data {RIP,LIP,RSP,LSP,RIA,LIA,RSA,LSA,IRP,ILP,SRP,SLP,IRA,ILA,SRA,SLA,RPI,LPI,RAI,LAI,RPS,LPS,RAS,LAS,PRI,PLI,ARI,ALI,PRS,PLS,ARS,ALS,IPR,SPR,IAR,SAR,IPL,SPL,IAL,SAL,PIR,PSR,AIR,ASR,PIL,PSL,AIL,ASL}]
                 [-mcs] [-omc] [-display-warp] [-to-fsl [<file> [<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" or "-omc" 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
  -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:
  -copy-header <file>   Copy the header of the source image (specified in -i) to
                        the destination image (specified here) and save it into
                        a new image (specified in -o)
  -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)

ORIENTATION OPERATIONS:
  -getorient            Get orientation of the input image (default: False)
  -setorient {RIP,LIP,RSP,LSP,RIA,LIA,RSA,LSA,IRP,ILP,SRP,SLP,IRA,ILA,SRA,SLA,RPI,LPI,RAI,LAI,RPS,LPS,RAS,LAS,PRI,PLI,ARI,ALI,PRS,PLS,ARS,ALS,IPR,SPR,IAR,SAR,IPL,SPL,IAL,SAL,PIR,PSR,AIR,ASR,PIL,PSL,AIL,ASL}
                        Set orientation of the input image (only modifies the
                        header).
  -setorient-data {RIP,LIP,RSP,LSP,RIA,LIA,RSA,LSA,IRP,ILP,SRP,SLP,IRA,ILA,SRA,SLA,RPI,LPI,RAI,LAI,RPS,LPS,RAS,LAS,PRI,PLI,ARI,ALI,PRS,PLS,ARS,ALS,IPR,SPR,IAR,SAR,IPL,SPL,IAL,SAL,PIR,PSR,AIR,ASR,PIL,PSL,AIL,ASL}
                        Set orientation of the input image's data (does NOT
                        modify the header, but the data). Use with care !

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> [<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 (dev)

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> | -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>          Create an image with regions labelized depending on
                        values from reference
  -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 (dev)

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.
Tips: To run the function with init txt file that includes flags -initz/-initcenter:
  sct_label_vertebrae -i t2.nii.gz -s t2_seg-manual.nii.gz  '$(< init_label_vertebrae.txt)'

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.6/site-packages/data/PAM50)
  -initz <list>        Initialize using slice number and disc value. Example:
                       68,4 (slice 68 corresponds to disc C3/C4). Example: 125,3
                       WARNING: Slice number should correspond to superior-
                       inferior direction (e.g. 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. (default: 0)
  -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. Default=32.
                         - size_AP [mm]: AP window size for disc search.
                         Default=11.
                         - size_RL [mm]: RL window size for disc search.
                         Default=1.
                         - size_IS [mm]: IS window size for disc search.
                         Default=19.
                         - gaussian_std [mm]: STD of the Gaussian function,
                         centered at the most rostral point of the image, and
                         used to weight C2-C3 disk location finding towards the
                         rostral portion of the FOV. Values to set between 0.1
                         (strong weighting) and 999 (no weighting). Default=1.0.
  -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 (dev)

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>]
                 [-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. Some inputs can be either a number or a 4d image or several 3d images separated with ","

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 multiple images
                        (separated with space).
  -sub  [ ...]          Subtract following input. Can be a number or an image.
  -mul  [ ...]          Multiply by following input. Can be a number or multiple
                        images (separated with space).
  -div  [ ...]          Divide by following input. Can be a number or an image.
  -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>          Use following number to threshold image (zero below
                        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: http://scikit-learn.org/stable
                        /modules/generated/sklearn.metrics.mutual_info_score.htm
                        l
  -minorm <file>        Compute the normalized mutual information (MI) between
                        both input files (-i and -mi) as in: http://scikit-learn
                        .org/stable/modules/generated/sklearn.metrics.normalized
                        _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 (dev)

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 images to the same space

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: True)

sct_process_segmentation

--
Spinal Cord Toolbox (dev)

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>] [-r <int>]
                                [-angle-corr <int>]
                                [-centerline-algo {polyfit,bspline,linear,nurbs}]
                                [-centerline-smooth <int>] [-qc <folder>]
                                [-qc-dataset <str>] [-qc-subject <str>]
                                [-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].
  - 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). If perfect ellipse, it should be one. This metric is interesting for detecting non-convex shape (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.

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 (requires '-p
                        csa'). 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.
  -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)
  -r <int>              Removes temporary folder used for the algorithm at the
                        end of execution. (default: 1)
  -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)
  -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)
  -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)

sct_propseg

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

sct_propseg -h
--

usage: sct_propseg -i <file> -c {t1,t2,t2s,dwi} [-h] [-o <file>] [-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>]
                   [-igt <file>]

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
  -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)
  -igt <file>           File name of ground-truth segmentation.

sct_qc

--
Spinal Cord Toolbox (dev)

sct_qc -h
--

usage: sct_qc -i IMAGE -p
              {sct_propseg,sct_deepseg_sc,sct_deepseg_gm,sct_register_multimodal,sct_register_to_template,sct_warp_template,sct_label_vertebrae,sct_detect_pmj,sct_label_utils,sct_get_centerline}
              [-s SEG] [-d DEST] [-qc QC] [-qc-dataset DATASET]
              [-qc-subject SUBJECT] [-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_register_multimodal,sct_register_to_template,sct_warp_template,sct_label_vertebrae,sct_detect_pmj,sct_label_utils,sct_get_centerline}
                        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)
  -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
  -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_register_multimodal

--
Spinal Cord Toolbox (dev)

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>]
                               [-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=centermassrot,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.
  -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).
                          - 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 '_'. T stands for translation and R
                          stands for rotation, x, y, and z indicating the
                          direction. For example, Tx_Ty_Tz_Rx_Ry_Rz would allow
                          translation on x, y and z axes and rotation on x, y
                          and z axes. Default=Tx_Ty_Tz_Rx_Ry_Rz.
                          - 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>       Just put source into destination (no optimization).
                        (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.
  -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 (dev)

sct_register_to_template -h
--

usage: sct_register_to_template -i <file> -s <file> [-h] [-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>]
                                [-igt <file>] [-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 defined 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 (only with the parameter '-disc') 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 and preferred method. This feature does not work with the parameter '-ref subject'.

More information about label creation can be found at https://www.icloud.com/keynote/0th8lcatyVPkM_W14zpjynr5g#SCT%%5FCourse%%5F20200121 (p47)

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.
  -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://www.icloud.com/keynote/0th8lcatyVPkM_W14zpjynr5g#
                        SCT%5FCourse%5F20200121 (p47)
  -ldisc <file>         Labels located at the posterior edge of the
                        intervertebral discs. Example: anat_labels.nii.gz
                        If you are using more than 2 labels, all disc 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://www.icloud
                        .com/keynote/0th8lcatyVPkM_W14zpjynr5g#SCT%5FCourse%5F20
                        200121 (p47)
  -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.6/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.
  -igt <file>           File name of ground-truth template cord segmentation
                        (binary nifti).
  -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 (dev)

sct_resample -h
--

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

Anisotropic resampling of 3D or 4D data.

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

TYPE OF THE NEW SIZE INPUT: with a factor of resampling, in mm or in number of voxels
Please choose only one of the 3 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
  -vox <str>            Resampling size in number of voxels in each dimensions
                        (x,y,z). Separate with 'x'.

OPTIONAL ARGUMENTS:
  -h, --help            Show this help message and exit.
  -ref <file>           Reference image to resample input image to. Uses world
                        coordinates.
  -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 (dev)

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 ...]]
                     [-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.
                        
                        Example YAML configuration:
                        path_data   : "~/sct_data"
                        path_output : "~/pipeline_results"
                        script      : "nature_paper_analysis.sh"
                        jobs        : -1
                        
                        Example JSON configuration:
                        {
                        "path_data"   : "~/sct_data"
                        "path_output" : "~/pipeline_results"
                        "script"      : "nature_paper_analysis.sh"
                        "jobs"        : -1
                        }
                        
  -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 to include.
                        Only process a subject if they are on this list.
                        Inclusions are processed before exclusions. Cannot be
                        used with `include`.
  -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 to exclude.
                        Only process a subject if they are not on this list.
                        Inclusions are processed before exclusions. Cannot be
                        used with either `exclude`.
  -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 flags and arguments to pass
                        to the script. For example 'sct_run_batch -path-data
                        data/ -script-args "-foo bar -baz /qux" process_data.sh
                        '
  -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 (dev)

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
  -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 (dev)

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 http://sourceforge.net/p
                        /spinalcordtoolbox/wiki/create_labels/. 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 (dev)

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

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. (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
                     .6/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)

System Commands

sct_check_dependencies

--
Spinal Cord Toolbox (dev)

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_testing

--
Spinal Cord Toolbox (dev)

sct_testing -h
--

usage: sct_testing [--function FUNCTION [FUNCTION ...]] [--download]
                   [--path PATH] [--remove-temps] [--jobs JOBS] [--verbose]
                   [--abort-on-failure] [--continue-from CONTINUE_FROM]
                   [--check-filesystem] [--execution-folder EXECUTION_FOLDER]
                   [-h]

Crash and integrity testing for functions of the Spinal Cord Toolbox. Internet connection is required for downloading testing data.

optional arguments:
  --function FUNCTION [FUNCTION ...], -f FUNCTION [FUNCTION ...]
                        Test this specific script (eg. 'sct_propseg').
  --download, -d
  --path PATH, -p PATH  Path to testing data. NB: no need to set if using "-d 1"
                        (default: sct_testing_data)
  --remove-temps, -r    Remove temporary files. (default: False)
  --jobs JOBS, -j JOBS  # of simultaneous tests to run (jobs). 0 or unspecified
                        means # of available CPU threads (2) (default: 2)
  --verbose, -v
  --abort-on-failure    Instead of iterating through all tests, abort at the
                        first one that would fail. (default: False)
  --continue-from CONTINUE_FROM
                        Instead of running all tests (or those specified by
                        --function, start from this one
  --check-filesystem    Check filesystem for unwanted modifications (default:
                        False)
  --execution-folder EXECUTION_FOLDER
                        Folder where to run tests from (default. temporary)
  -h, --help            show this message and exit

sct_version

dev

Internal Commands

These scripts are tailored to the developers.

isct_convert_binary_to_trilinear

--
Spinal Cord Toolbox (dev)

isct_convert_binary_to_trilinear -h
--


isct_convert_binary_to_trilinear.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Part of the Spinal Cord Toolbox <https://sourceforge.net/projects/spinalcordtoolbox>

DESCRIPTION
  Convert binary spinal cord segmentation to trilinear-interpolated segmentation. Instead of simply
  re-interpolating the image, this function oversamples the binary mask, smoothes along centerline
  (to remove step-effects), then downsamples back to native resolution.

USAGE
  isct_convert_binary_to_trilinear.py -i <bin_seg>

MANDATORY ARGUMENTS
  -i <bin_seg>      binary segmentation of spinal cord

OPTIONAL ARGUMENTS
  -s                sigma of the smoothing Gaussian kernel (in voxel). Default=5
  -r {0,1}          remove temporary files. Default=1
  -v {0,1}          verbose. Default=1
  -h                help. Show this message

EXAMPLE
  isct_convert_binary_to_trilinear.py -i segmentation.nii

isct_minc2volume-viewer

usage: isct_minc2volume-viewer.py [-h] [-o FNAME_OUT] filename

positional arguments:
  filename              absolute path of input image

optional arguments:
  -h, --help            show this help message and exit
  -o FNAME_OUT, --fname_out FNAME_OUT
                        absolute path of output image (without image format)

isct_test_ants

--
Spinal Cord Toolbox (dev)

isct_test_ants -h
--


isct_test_ants.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Part of the Spinal Cord Toolbox <https://sourceforge.net/projects/spinalcordtoolbox>

DESCRIPTION
  This function test the integrity of ANTs output, given that some versions of ANTs give a wrong BSpline   transform notably when using sct_ANTSUseLandmarkImagesToGetBSplineDisplacementField..

USAGE
  isct_test_ants.py

OPTIONAL ARGUMENTS
  -h                         show this help
  -r {0, 1}                  remove temp files. Default=1
  -v {0, 1}                  verbose. Default=1