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: Measured as average across 3 mm extent centred at cord mask center of mass.

  • length_anterior: Anterior length of the spinal cord along the AP axis, measured as average across 3 mm extent centred at cord mask center of mass, from the center of mass to the anterior cord edge.

  • length_posterior: Posterior length of the spinal cord along the AP axis, measured as average across 3 mm extent centred at cord mask center of mass, from the center of mass to the posterior cord edge.

  • diameter_RL: Measured as the major axis of the ellipse fitted to the cord.

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

  • symmetry_dice: Dice score between the left and right (RL) hemicords or anterior and posterior (AP) halves of the spinal cord.

  • symmetry_hausdorff [mm]: Hausdorff distance between the left and right (RL) hemicords or anterior and posterior (AP) halves of the spinal cord.

  • symmetry_difference [mm^2]: Absolute difference between the left and right (RL) hemicords or anterior and posterior (AP) halves of the spinal cord.

  • area_quadrant: Cross-sectional area of the spinal cord in each quadrant (anterior-left, anterior-right, posterior-left, posterior-right). 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> [-o <file>] [-append <int>] [-z <str>]
                                [-perslice <int>] [-vert <str>]
                                [-vertfile <str>] [-discfile <str>]
                                [-perlevel <int>] [-angle-corr <int>]
                                [-centerline <str>]
                                [-centerline-algo {polyfit,bspline,linear,nurbs}]
                                [-centerline-smooth <int>]
                                [-centerline-exclude-missing <int>]
                                [-pmj <file>] [-pmj-distance <float>]
                                [-pmj-extent <float>] [-anat <file>]
                                [-normalize <list> [<list> ...]]
                                [-normalize-PAM50 <int>] [-qc <folder>]
                                [-qc-image <str>] [-qc-dataset <str>]
                                [-qc-subject <str>] [-h] [-v <int>] [-r {0,1}]

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

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 generated by sct_label_vertebrae or sct_warp_template. Only use with flag -vert.

The input and the vertebral labelling file must be in the same voxel coordinate system and must match the dimensions between each other. Example: ./label/template/PAM50_levels.nii.gz This flag will be deprecated in favor of -discfile in the future.

-discfile

File with single-voxel labels identifying the intervertebral discs generated with sct_deepseg spine or sct_label_utils. Used with -vert to aggregate metrics within vertebral levels. Disc labels will be projected onto the spinal cord to identify vertebral levels. Example: ./label/template/PAM50_label_disc.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

-centerline

Mask image containing a SC seg or centerline. (Optional: If not provided, the centerline will be derived from -i instead.)

The -centerline image is used with other flags:

  • -angle-corr 1: If provided, angles will be computed using the shape of the -centerline image (which will then be used to angle-correct the metrics for -i).

  • -discfile: If provided, the disc labels will be projected onto the -centerline image (which will then be used to aggregate the metrics for -i).

You should specify this option if you want to override the centerline that would be derived from -i. For example:

  • You are calculating the CSA of an irregular segmentation (e.g. lesion mask) that would produce poor angle correction.

  • You are calculating the CSA of multiple segmentations for the same subject and want a consistent centerline for both.

-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

-centerline-exclude-missing

Possible choices: 0, 1

By default, an error will be thrown if -centerline does not completely cover the input segmentation. Setting this flag to 1 will bypass the error, by skipping segmentation slices that aren’t covered by the centerline. Use with caution; sometimes it is preferable to manually correct the -centerline image instead (so that the -centerline image covers all of the segmentation slices).

Default: 0

-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

-anat

Input image used to compute spinal cord orientation (using HOG method). It is required to compute symmetry and quadrants area metrics.Example: t2.nii.gz

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

MISC ARGUMENTS

-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

Remove temporary files.

Default: 1