sct_get_centerline

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

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

MANDATORY ARGUMENTS

-i

Input image. Example: t1.nii.gz

OPTIONAL ARGUMENTS

-c

Possible choices: t1, t2, t2s, dwi

Type of image contrast. Only with method=optic.

-method

Possible choices: optic, viewer, fitseg

Method used for extracting the centerline.

  • optic: automatic spinal cord detection method

  • viewer: manual selection a few points followed by interpolation

  • fitseg: fit a regularized centerline on an already-existing cord segmentation. This method will interpolate if any slices are missing. Also, if -extrapolation 1 is specified, this method will extrapolate beyond the segmentation boundaries (i.e., every axial slice will exhibit a centerline pixel).

Default: “optic”

-centerline-algo

Possible choices: polyfit, bspline, linear, nurbs

Algorithm for centerline fitting. Only relevant with -method fitseg.

Default: “bspline”

-centerline-smooth

Degree of smoothing for centerline fitting. Only for -centerline-algo {bspline, linear}.

Default: 30

-centerline-soft

Possible choices: 0, 1

Binary or soft centerline. 0 = binarized, 1 = soft. Only relevant with -method fitseg.

Default: 0

-space

Possible choices: pix, phys

The coordinate space to use for units when outputting the centerline coordinates to a .csv file.’pix’=pixel dimensions, ‘phys’=physical dimensions.

Default: “pix”

-extrapolation

Possible choices: 0, 1

Extrapolate beyond the segmentation boundaries. 0 = no extrapolation, 1 = extrapolation. Only relevant with -method fitseg.Note: -extrapolation 1 works best with lower-order (linear, nurbs) centerline fitting algorithms

Default: 0

-o

File name for the centerline output file. If file extension is not provided, .nii.gz will be used by default. If -o is not provided, then the output file will be the input with suffix _centerline. Example: centerline_optic.nii.gz

-gap

Gap in mm between manually selected points. Only with method=viewer.

Default: 20.0

-v

Possible choices: 0, 1, 2

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

Default: 1

-r

Possible choices: 0, 1

Whether to remove temporary files. 0 = no, 1 = yes

Default: 1

-qc

The path where the quality control generated content will be saved.

-qc-dataset

If provided, this string will be mentioned in the QC report as the dataset the process was run on.

-qc-subject

If provided, this string will be mentioned in the QC report as the subject the process was run on.