How do I use SCT on the separated sagittal/axial/coronal sections generated by `dcm2bids`?

Hello @jcohenadad and @joshuacwnewton , thank you for responses above. I am a beginner myself. I have a similar question and I realize that this may be too basic. I used dcm2bids converter to convert my dicom files to nifti format with BIDS sidecars. This is what the “ls” of my target output directory for an example MRI looks like:

Directory: E:\Alvi\Thesis\tmp_dcm2bids\helper
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2024-02-12   3:46 PM            911 002_TOH1002_COR_LOC.json
-a----        2024-02-12   3:46 PM        1493545 002_TOH1002_COR_LOC.nii.gz
-a----        2024-02-12   3:46 PM           1001 003_TOH1002_SAG_T2_FSE_16_PSAT.json
-a----        2024-02-12   3:46 PM        3736351 003_TOH1002_SAG_T2_FSE_16_PSAT.nii.gz
-a----        2024-02-12   3:46 PM            973 004_TOH1002_SAG_T1_FSE_2_PSAT.json
-a----        2024-02-12   3:46 PM        3784015 004_TOH1002_SAG_T1_FSE_2_PSAT.nii.gz
-a----        2024-02-12   3:46 PM            995 005_TOH1002_AXIAL_T2_FST_VOL_MTC_PSAT.json
-a----        2024-02-12   3:46 PM        6321888 005_TOH1002_AXIAL_T2_FST_VOL_MTC_PSAT.nii.gz
-a----        2024-02-12   3:46 PM            939 006_TOH1002_AXIAL_T2_FSE_16.json
-a----        2024-02-12   3:46 PM        1893630 006_TOH1002_AXIAL_T2_FSE_16.nii.gz

As you can, see converting the whole DICOM folder to NIFTI generates these individual sequences. How can I use these files to then input into sct_deepseg_sc?

Again, I apologize if this is too basic or if this is not the right place to ask this?

Hi @alialvi92,

I am just going to move your message into a separate forum post (to help make the forum more searchable for future readers). Then I will answer your message. :slight_smile:

Sounds good, thank you so much and again, apologies for the inconvenience!

1 Like

Hi @alialvi92,

For basic usage of sct_deepseg_sc, you can find a tutorial for spinal cord segmentation here: Segmentation - Spinal Cord Toolbox documentation

The hands-on portion of the tutorial is here: Hands-on: Using sct_deepseg_sc on T2 data - Spinal Cord Toolbox documentation

If you want to run sct_deepseg_sc many times (e.g. multiple scans/contrasts per subject, and multiple subjects in a dataset), then we recommend using sct_run_batch. We have a tutorial for this here: Analysis pipelines with SCT - Spinal Cord Toolbox documentation

Please let me know if you have any further questions or concerns.

Kind regards,

Thanks @joshuacwnewton , yes I have been through the tutorials for both sct_deepseg_sc as well as sct_run_batch. I guess my main concern is the difference in nifti files that I am looking at vs what we see in the hands-on section for sct_deepseg_sc. When I open the t2.nii.gz in MRIcroGL for instance, I can see all the 3 views since its a 3D MRI. However, when I am using my own files and converting the entire DICOM MRI to nifti using dcm2bids, I am only able to generate the axial and sagittal and coronal sections as separate nii.gz files. So I am able to open ONLY ONE OF THE SEQUENCES at a time in MRIcroGL.
So I am not sure how to use sct_deepseg_sc for these files? Is there a way I can manually generate a 3D MRI nii.gz from these files?

1 Like

Ahh, thank you so much for the additional explanation. Your question is much clearer now. :heart:

Personally, I am not too familiar with the dcm2bids conversion process. (I have personally used dcm2niix only a few times, and I haven’t come across separated output such as this.) So, I will ask my colleagues to see if they have any insight into how to approach your situation.

Kind regards,

Perfect, thanks so much! If this helps your colleagues, the MRIs that I am using are pretty old, early 2010s late 2000s, not sure if that matters but just wanted to mention that. Thanks again!

Hello @alialvi92!

Yes, this is expected. You can also notice that the example t2.nii.gz image has the same resolution in all three planes (axial, sagittal, coronal). This is because the image is a so-called isotropic scan, meaning that voxels have the same size in all three planes. In this case, it is 0.8 x 0.8 x 0.8 mm. You can verify this by running sct_image and looking for tag pixdim:

sct_image -i t2.nii.gz -header
pixdim		[1.0, 0.8, 0.8, 0.8, 1.5, 0.0, 0.0, 0.0]

At the same time, sct_image can be used to show the number of slices for individual planes (axial, sagittal, coronal); see tag dim:

sct_image -i t2.nii.gz -header
dim		[3, 64, 320, 320, 1, 0, 0, 0]

You can notice that the t2.nii.gz image has 64, 320, and 320 slices making it “3D”.

Can you please run the sct_image command for your images to see their pixdim and dim? For example sct_image -i 003_TOH1002_SAG_T2_FSE_16_PSAT.nii.gz -header.

Thank you!

Thank you so much @valosekj for taking the time to explain.

sct_image -i 003_TOH1002_SAG_T2_FSE_16_PSAT.nii.gz -header

dim [3, 512, 512, 12, 1, 1, 1, 1]

pixdim [-1.0, 0.429688, 0.429688, 3.5, 3.5, 0.0, 0.0, 0.0]

I also ran it for the axial scan
sct_image -i 003_TOH1002_AXIAL_T2_FSE_16.nii.gz -header

dim [3, 256, 256, 32, 1, 1, 1, 1]

pixdim [-1.0, 0.78125, 0.78125, 3.500037, 6.0, 0.0, 0.0, 0.0]

What would you recommend? Thanks again!

Thank you for the provided details @alialvi92!

Based on the sct_image output, both your images seem to be 3D:

  • 003_TOH1002_SAG_T2_FSE_16_PSAT.nii.gz has dimensions 512 x 512 x 12.

  • 003_TOH1002_AXIAL_T2_FSE_16.nii.gz has dimensions 256 x 256 x 32.

So, you should be able to run sct_deepseg_sc using the following commands (one command for each image):

sct_deepseg_sc -i 003_TOH1002_SAG_T2_FSE_16_PSAT.nii.gz -c t2
sct_deepseg_sc -i 003_TOH1002_AXIAL_T2_FSE_16.nii.gz -c t2
1 Like

Also please note that segmenting the spinal cord on sagittal slices of 3.5mm is not optimal. I recommend to either run the segmentation on axial scans, or on scans with ‘good’ isotropic resolution (eg. 1mm iso)

1 Like

Thank you so much @valosekj and @jcohenadad . I was able to run sct_deepseg_sc on both of them separately. My concern is that how reliable would be, for instance, something like measuring CSA across different levels? I remember from the course videos from Dec 2023 that proper segmentation is critical for obtaining accurate CSA values.
I have attached the FSL eyes output as well as the QC report for both sagittal and axial image. I am aware that I can manually correct the segmentation on FSL eyes but given that I will be doing for sagittal and axial separately, would this be appropriate and would it generate reliable quantitative metrics like CSA?


As mentioned by @jcohenadad, the sagittal sequence (003_TOH1002_SAG_T2_FSE_16_PSAT.nii.gz) with highly anisotropic sagittal slices (0.429688 x 0.429688 x 3.5) is suboptimal for computing CSA. Therefore, I would go with the axial sequence (003_TOH1002_AXIAL_T2_FSE_16.nii.gz) to measure CSA.

PS: based on the provided screenshots, I can see you work with a compressed cord. Note that in SCT v6.2 (which will be released in the following days), we will release a new model (sct_deepseg -task seg_sc_lesion_t2w_sci), which might work even in highly compressed cords. Thus potentially minimizing the amount of manual corrections. More details about this new model can be found in this preprint.

Oh that is fantastic! Thanks so much. @valosekj , so looking forward to this release! Kudos to all of you!