sc_epi¶
Spinal cord segmentation for EPI-BOLD fMRI data
This segmentation model for spinal cord on EPI data (single 3D volume) uses a 3D UNet model built from the nnUNetv2 framework. The training data consists of 3D images (n=192) spanning numerous resolutions from multiple sites like Max Planck Institute for Human Cognitive and Brain Sciences - Leipzig, University of Geneva, Stanford University, Kings College London, Universitätsklinikum Hamburg. The dataset has healthy control subjects. The model has been trained in a human-in-the-loop active learning fashion.
Reference¶
@article{Banerjee2025.01.07.631402,
author={Banerjee, Rohan and Kaptan, Merve and Tinnermann, Alexandra and Khatibi, Ali and Dabbagh, Alice and B{"u}chel, Christian and K{"u}ndig, Christian W. and Law, Christine S.W. and Pfyffer, Dario and Lythgoe, David J. and Tsivaka, Dimitra and Van De Ville, Dimitri and Eippert, Falk and Muhammad, Fauziyya and Glover, Gary H. and David, Gergely and Haynes, Grace and Haaker, Jan and Brooks, Jonathan C. W. and Finsterbusch, J{"u}rgen and Martucci, Katherine T. and Hemmerling, Kimberly J. and Mobarak-Abadi, Mahdi and Hoggarth, Mark A. and Howard, Matthew A. and Bright, Molly G. and Kinany, Nawal and Kowalczyk, Olivia S. and Freund, Patrick and Barry, Robert L. and Mackey, Sean and Vahdat, Shahabeddin and Schading, Simon and McMahon, Stephen B. and Parish, Todd and Marchand-Pauvert, V{'e}ronique and Chen, Yufen and Smith, Zachary A. and Weber, Kenneth A. and De Leener, Benjamin and Cohen-Adad, Julien},
title={EPISeg: Automated segmentation of the spinal cord on echo planar images using open-access multi-center data},
elocation-id{2025.01.07.631402},
year{2025},
doi{10.1101/2025.01.07.631402},
publisher{Cold Spring Harbor Laboratory},
abstract{Functional magnetic resonance imaging (fMRI) of the spinal cord is relevant for studying sensation, movement, and autonomic function. Preprocessing of spinal cord fMRI data involves segmentation of the spinal cord on gradient-echo echo planar imaging (EPI) images. Current automated segmentation methods do not work well on these data, due to the low spatial resolution, susceptibility artifacts causing distortions and signal drop-out, ghosting, and motion-related artifacts. Consequently, this segmentation task demands a considerable amount of manual effort which takes time and is prone to user bias. In this work, we (i) gathered a multi-center dataset of spinal cord gradient-echo EPI with ground-truth segmentations and shared it on OpenNeuro https://openneuro.org/datasets/ds005143/versions/1.3.0, and (ii) developed a deep learning-based model, EPISeg, for the automatic segmentation of the spinal cord on gradient-echo EPI data. We observe a significant improvement in terms of segmentation quality compared to other available spinal cord segmentation models. Our model is resilient to different acquisition protocols as well as commonly observed artifacts in fMRI data. The training code is available at https://github.com/sct-pipeline/fmri-segmentation/, and the model has been integrated into the Spinal Cord Toolbox as a command-line tool.Competing Interest StatementSince January 2024, Dr. Barry has been employed by the National Institute of Biomedical Imaging and Bioengineering at the National Institutes of Health. This work was co-authored by Robert Barry in his personal capacity. The opinions expressed in this study are his own and do not necessarily reflect the views of the National Institutes of Health, the Department of Health and Human Services, or the United States government. The other authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.},
URL{https://www.biorxiv.org/content/early/2025/01/27/2025.01.07.631402},
eprint{https://www.biorxiv.org/content/early/2025/01/27/2025.01.07.631402.full.pdf},
journal{bioRxiv}
}
Project URL: https://github.com/sct-pipeline/fmri-segmentation
usage: sct_deepseg sc_epi [-i <file> [<file> ...]] [-o <str>] [-install]
[-custom-url CUSTOM_URL [CUSTOM_URL ...]]
[-thr <float>] [-largest {0,1}] [-fill-holes {0,1}]
[-remove-small REMOVE_SMALL [REMOVE_SMALL ...]]
[-qc <folder>] [-qc-dataset <str>] [-qc-subject <str>]
[-qc-plane <str>] [-qc-seg <file>] [-h] [-v <int>]
[-profile-time [<file>]] [-trace-memory [<folder>]]
[-r {0,1}]
INPUT/OUTPUT¶
- -i
Image to segment. Can be multiple images (separated with space).
Note: If choosing
lesion_ms_mp2rage
, then the input data must be cropped around the spinal cord. (To crop the data you can first segment the spinal cord using the contrast agnostic model. This could be done using: “sct_deepseg spinalcord -i IMAGE -o IMAGE_sc”, then crop the image with 30 mm of dilation on axial orientation around the spinal cord. This could be done using: “sct_crop_image -i IMAGE -m IMAGE_sc -dilate 30x30x5”. Note that 30 is only for 1mm isotropic resolution, for images with another resolution divide 30/your_axial_resolution.)- -o
Output file name. In case of multi-class segmentation, class-specific suffixes will be added. By default,the suffix specified in the packaged model will be added and output extension will be
.nii.gz
.
TASKS¶
- -install
Install models that are required for specified task.
Default: False
- -custom-url
URL(s) pointing to the
.zip
asset for a model release. This option can be used with-install
to install a specific version of a model. To use this option, navigate to the ‘Releases’ page of the model, find release you wish to install, and right-click + copy the URL of the.zip
listed under ‘Assets’. NB: For multi-model tasks, provide multiple URLs. For single models, just provide one URL. Example:sct_deepseg rootlets -install -custom-url https://github.com/ivadomed/model-spinal-rootlets/releases/download/r20240523/model-spinal-rootlets_ventral_D106_r20240523.zip
sct_deepseg rootlets -i sub-amu01_T2w.nii.gz
PARAMETERS¶
- -thr
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).
- -largest
Possible choices: 0, 1
Keep the largest connected object from each output segmentation; if not set, all objects are kept.
Default: 0
- -fill-holes
Possible choices: 0, 1
If set, small holes in the segmentation will be filled in automatically.
Default: 0
- -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 ARGUMENTS¶
- -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.
- -qc-plane
Possible choices: Axial, Sagittal
Plane of the output QC. If Sagittal, it is highly recommended to provide the
-qc-seg
option, as it will ensure the output QC is cropped to a reasonable field of view. (Note: Sagittal view is not currently supported for rootlets/totalspineseg QC.)Default: “Axial”
- -qc-seg
Segmentation file to use for cropping the QC. This option is useful when you want to QC a region that is different from the output segmentation. For example, for lesion segmentation, it might be useful to provide a cord segmentation to expand the QC field of view to include the full cord, while also still excluding irrelevant tissue. If not provided, the default behavior will depend on the
-qc-plane
:‘Axial’: A sensibly chosen crop radius between 15-40 vox, depending on the resolution and segmentation type.
‘Sagittal’: The full image. (For very large images, this may cause a crash, so using
-qc-seg
is highly recommended.)
- -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 assnakeviz
).- -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 additionalsnapshot_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