sct_straighten_spinalcord

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

usage: sct_straighten_spinalcord -i <file> -s <file> [-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>] [-h]
                                 [-v <int>] [-profile-time [<file>]]
                                 [-trace-memory [<folder>]] [-r {0,1}]

MANDATORY ARGUMENTS

-i

Input image with curved spinal cord. Example: t2.nii.gz

-s

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 spinalcord. Example: centerline.nii.gz

OPTIONAL ARGUMENTS

-dest

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

Labels located at the posterior edge of the intervertebral discs, for the input image (-i). All disc covering the region of interest should be provided. Exmaple: if you are interested in levels C2 to C7, then you should provide disc labels 2,3,4,5,6,7). More details about label creation at https://spinalcordtoolbox.com/user_section/tutorials/vertebral-labeling.html. This option must be used with the -ldisc-dest parameter.

-ldisc-dest

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

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

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

Straightened file. By default, the suffix “_straight” will be added to the input file name.

Default: “”

-ofolder

Output folder (all outputs will go there).

Default: “.”

-centerline-algo

Possible choices: bspline, linear, nurbs

Algorithm for centerline fitting. Default: nurbs.

Default: “nurbs”

-centerline-smooth

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

Default: 10

-param

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

Possible choices: nn, linear, spline

Final interpolation. Default: spline.

Default: “spline”

-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

MISC ARGUMENTS

-v

Possible choices: 0, 1, 2

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

Default: 1

-profile-time

Enables time-based profiling of the program, dumping the results to the specified file.

If no file is specified, human-readable results are placed into a ‘time_profiling_results.txt’ document in the current directory (’/home/docs/checkouts/readthedocs.org/user_builds/spinalcordtoolbox/checkouts/stable/documentation/source’). If the specified file is a .prof file, the file will instead be in binary format, ready for use with common post-profiler utilities (such as snakeviz).

-trace-memory

Enables memory tracing of the program.

When active, a measure of the peak memory (in KiB) will be output to the file peak_memory.txt. Optionally, developers can also modify the SCT code to add additional snapshot_memory() calls. These calls will ‘snapshot’ the memory usage at that moment, saving the memory trace at that point into a second file (memory_snapshots.txt).

By default, both outputs will be placed in the current directory (’/home/docs/checkouts/readthedocs.org/user_builds/spinalcordtoolbox/checkouts/stable/documentation/source’). Optionally, you may provide an alternative directory (-trace-memory <dir_name>), in which case all files will be placed in that directory instead. Note that this WILL incur an overhead to runtime, so it is generally advised that you do not run this in conjunction with the time profiler or in time-sensitive contexts.

-r

Possible choices: 0, 1

Remove temporary files.

Default: 1