Preprocess for register

Dear SCT team, hello. Thank you for taking the time to review my question:
I currently have two files(Sagittal plane Transverse plane(2D-t2) Due to size limitations, I am unable to upload the files.)
I have obtained the information about the gray matter using the following command:
sct_deepseg_sc -i t2.nii.gz -c t2
sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2
sct_deepseg_sc -i t2s.nii.gz -c t2s
sct_deepseg_gm -i t2s.nii.gz
sct_register_multimodal -i t2_seg_labeled.nii.gz -d t2s.nii.gz -identity 1 -x nn
sct_process_segmentation -i t2s_gmseg.nii.gz -vertfile t2_seg_labeled_reg.nii.gz -vert 1:9 -perlevel 1 -o csa_gm_perlevel.csv
sct_process_segmentation -i t2s_gmseg.nii.gz -vertfile t2_seg_labeled_reg.nii.gz -z 1:20 -perslice 1 -o csa_gm_perslice.csv

Now, I would like to obtain the segmented and registered images or masks of the spinal cord and gray matter… Do you have any command suggestions for that?Thank you for your past and future assistance.

Hi @Xujian_Wang,

Thank you for reaching out. Based on your commands, you already segmented the spinal cord and gray matter, so I’m not sure I understand what you mean by “I would like to obtain the segmented and registered images or masks”. You already obtained them. Can you please clarify what you are trying to achieve?

Also, if size is a limitation to upload your files here, there are many other cloud options to share your files.


I apologize for my expression.
In fact, I want to obtain a mask of the straightened spinal cord and gray matter for further image processing. Do you have any suggestions?

You have at least two options:

  • You could run sct_straighten_spinalcord and then apply the computer warping field to your masks using sct_apply_transfo. You should choose the interpolation method carefully, depending on what you want to do with the masks.
  • Alternatively, you could register your data to the PAM50 template using sct_register_to_template, and then use the GM and SC masks directly from the template.

Sorry for the belated thanks, but your advice has been very useful to my research