sct_process_segmentation

Compute the following morphometric measures based on the spinal cord segmentation:

  • area [mm^2]: Cross-sectional area, measured by counting pixels in each slice. Partial volume can be accounted for by inputing a mask comprising values within [0,1]. Can be normalized when specifying the flag -normalize

  • angle_AP, angle_RL: Estimated angle between the cord centerline and the axial slice. This angle is used to correct for morphometric information.

  • diameter_AP, diameter_RL: Finds the major and minor axes of the cord and measure their length.

  • eccentricity: Eccentricity of the ellipse that has the same second-moments as the spinal cord. The eccentricity is the ratio of the focal distance (distance between focal points) over the major axis length. The value is in the interval [0, 1). When it is 0, the ellipse becomes a circle.

  • orientation: angle (in degrees) between the AP axis of the spinal cord and the AP axis of the image

  • solidity: CSA(spinal_cord) / CSA_convex(spinal_cord). The more ellipse-shaped the cord is (i.e. the closer the perimeter of the cord is to being fully convex), the closer the solidity ratio will be to 1. This metric is interesting for detecting concave regions (e.g., in case of strong compression).

  • length: Length of the segmentation, computed by summing the slice thickness (corrected for the centerline angle at each slice) across the specified superior-inferior region.

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

To select the region to compute metrics over, choose one of the following arguments:

  1. -z: Select axial slices based on slice index.

  2. -pmj + -pmj-distance + -pmj-extent: Select axial slices based on distance from pontomedullary junction. (For options 1 and 2, you can also add ‘-perslice’ to compute metrics for each axial slice, rather than averaging.)

  3. -vert + -vertfile: Select a region based on vertebral labels instead of individual slices. (For option 3, you can also add -perlevel to compute metrics for each vertebral level, rather than averaging.)

References:

  • -pmj/-normalize: Bédard S, Cohen-Adad J. Automatic measure and normalization of spinal cord cross-sectional area using the pontomedullary junction. Frontiers in Neuroimaging 2022. https://doi.org/10.3389/fnimg.2022.1031253

  • -normalize-PAM50: Valošek J, Bédard S, Keřkovský M, Rohan T, Cohen-Adad J. A database of the healthy human spinal cord morphometry in the PAM50 template space. Imaging Neuroscience 2024; 2 1–15. https://doi.org/10.1162/imag_a_00075

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

MANDATORY ARGUMENTS

-i

Mask to compute morphometrics from. Could be binary or weighted. E.g., spinal cord segmentation.Example: seg.nii.gz

OPTIONAL ARGUMENTS

-o

Output file name (add extension).

Default: “csa.csv”

-append

Possible choices: 0, 1

Append results as a new line in the output csv file instead of overwriting it.

Default: 0

-z

Slice range to compute the metrics across. Example: 5:23

Default: “”

-perslice

Possible choices: 0, 1

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

Vertebral levels to compute the metrics across. Example: 2:9 for C2 to T2. If you also specify a range of slices with flag -z, the intersection between the specified slices and vertebral levels will be considered.

Default: “”

-vertfile

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

Possible choices: 0, 1

Set to 1 to output one metric per vertebral level instead of a single output metric. This flag needs to be used with flag -vert.

Default: 0

-angle-corr

Possible choices: 0, 1

Angle correction for computing morphometric measures. When angle correction is used, the cord within the slice is stretched/expanded by a factor corresponding to the cosine of the angle between the centerline and the axial plane. If the cord is already quasi-orthogonal to the slab, you can set -angle-corr to 0.

Default: 1

-angle-corr-centerline

Image to be used as a centerline for computing angle correction (can be either a cord segmentation or a single-voxel centerline mask). This argument is optional; if not provided, the centerline will be derived from the input segmentation. Use this option if the input segmentation is irregularly shaped (e.g. gray/white matter). In such a case, it is best to pass the full cord segmentation to this option, as you will get a more accurate centerline (and thus a more accurate, consistent angle correction).

-centerline-algo

Possible choices: polyfit, bspline, linear, nurbs

Algorithm for centerline fitting. Only relevant with -angle-corr 1.

Default: “bspline”

-centerline-smooth

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

Default: 30

-pmj

Ponto-Medullary Junction (PMJ) label file. Example: pmj.nii.gz

-pmj-distance

Distance (mm) from Ponto-Medullary Junction (PMJ) to the center of the mask used to compute morphometric measures. (To be used with flag -pmj.)

-pmj-extent

Extent (in mm) for the mask used to compute morphometric measures. Each slice covered by the mask is included in the calculation. (To be used with flag -pmj and -pmj-distance.)

Default: 20.0

-normalize

Normalize CSA values (’MEAN(area)’). Two models are available: 1. sex, brain-volume, thalamus-volume. 2. sex, brain-volume. Specify each value for the subject after the corresponding predictor. Example: -normalize sex 0 brain-volume 960606.0 thalamus-volume 13942.0 *brain-volume and thalamus-volume are in mm^3. For sex, female: 0, male: 1.

The models were generated using T1w brain images from 804 healthy (non-pathological) participants ranging from 48 to 80 years old, taken from the UK Biobank dataset. For more details on the subjects and methods used to create the models, go to: https://github.com/sct-pipeline/ukbiobank-spinalcord-csa#readme Given the risks and lack of consensus surrounding CSA normalization, we recommend thoroughly reviewing the literature on this topic before applying this feature to your data.

-normalize-PAM50

Possible choices: 0, 1

Set to 1 to bring the metrics in the PAM50 anatomical dimensions perslice. -vertfile and -perslice need to be specified.

Default: 0

-qc

The path where the quality control generated content will be saved. The QC report is only available for PMJ-based CSA (with flag -pmj).

-qc-image

Input image to display in QC report. Typically, it would be the source anatomical image used to generate the spinal cord segmentation. This flag is mandatory if using flag -qc.

-qc-dataset

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.

-r

Possible choices: 0, 1

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

Default: 1

-v

Possible choices: 0, 1, 2

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

Default: 1