Calculate the average area from C1 to C3 from the 3D-T1 brain data

I want to calculate the average area from C1 to C3 from the 3D-T1 data.

I encountered the following error with the two lines of code I segmented:

sct_deepseg_sc -i T1.nii.gz -c t1 -qc ~/qc_singleSubj
sct_label_vertebrae -i T1.nii.gz -s T1_seg.nii.gz -c t1 -qc ~/qc_singleSubj

The error is as follows:
Image /tmp/sct_2024-06-05_16-45-13_label-vertebrae_g05vbwge/data.nii has different qform and sform matrices. This can produce incorrect results. Please use ‘sct_image -i /tmp/sct_2024-06-05_16-45-13_label-vertebrae_g05vbwge/data.nii -header’ to check that both affine matrices are valid. Then, consider running either ‘sct_image -set-sform-to-qform’ or ‘sct_image -set-qform-to-sform’ to fix any discrepancies you may find.
Traceback (most recent call last):
File “/home/dawn/sct_6.3/spinalcordtoolbox/scripts/sct_label_vertebrae.py”, line 500, in
main(sys.argv[1:])
File “/home/dawn/sct_6.3/spinalcordtoolbox/scripts/sct_label_vertebrae.py”, line 324, in main
sct_straighten_spinalcord.main(argv=[
File “/home/dawn/sct_6.3/spinalcordtoolbox/scripts/sct_straighten_spinalcord.py”, line 261, in main
fname_straight = sc_straight.straighten()
File “/home/dawn/sct_6.3/spinalcordtoolbox/straightening.py”, line 108, in straighten
Image(fname_anat, check_sform=True).save(os.path.join(path_tmp, “data.nii”))
File “/home/dawn/sct_6.3/spinalcordtoolbox/image.py”, line 321, in init
raise ValueError(“Image sform does not match qform”)
ValueError: Image sform does not match qform

I’m wondering if the issue is because my 3D-T1 matrix is 1.211 and the FOV is 170256256. How can I solve this problem?

Hi @defuse_dawn,

As the error message states, the qform and sform of your images are different. Have you tried doing what is suggested, ie, setting the sform to the qform (or the other way around) using sct_image -set-sform-to-qform?

Thank you for your timely response. Before processing the images, I used sct_image -i T1.nii.gz -set-sform-to-qform, and found that segmentation could be performed without any errors. Additionally, I would like to ask if I can obtain Quantify spinal cord compression, Gray matter segmentation, and Atlas-based analysis through 3D-T1 Brain.

I would like to ask if I can obtain Quantify spinal cord compression

If the brain FOV covers the compression part, then yes

Gray matter segmentation

If your T1w scan shows sufficient gray/white matter contrast, then yes

and Atlas-based analysis through 3D-T1 Brain

Yes