Problem with Label vertebrae/discs

When I ran sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -qc ~/qc_singleSubj

forest@DESKTOP-DM8SQ21:~/pt/HC022/t2$ sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -qc ~/qc_singleSubj

Spinal Cord Toolbox (5.2.0)

sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -qc /home/forest/qc_singleSubj

Creating temporary folder (/tmp/sct-20210516150312.458917-label_vertebrae-f85scjk4)

Copying input data to tmp folder...

Straighten spinal cord...
Creating temporary folder (/tmp/sct-20210516150313.011246-straighten_spinalcord-9ucvt38g)
Copy files to tmp folder...
Image /tmp/sct-20210516150312.458917-label_vertebrae-f85scjk4/data.nii has different qform and sform matrices. This can produce incorrect results. Consider setting the two matrices to be equal by running:
sct_image -i /tmp/sct-20210516150312.458917-label_vertebrae-f85scjk4/data.nii -set-sform-to-qform -o /tmp/sct-20210516150312_same-affine.458917-label_vertebrae-f85scjk4/data.nii.
Traceback (most recent call last):
  File "/home/forest/sct/spinalcordtoolbox/scripts/", line 491, in <module>
  File "/home/forest/sct/spinalcordtoolbox/scripts/", line 310, in main
    '-v', str(verbose),
  File "/home/forest/sct/spinalcordtoolbox/scripts/", line 262, in main
    fname_straight = sc_straight.straighten()
  File "/home/forest/sct/spinalcordtoolbox/", line 107, in straighten
    Image(fname_anat, check_sform=True).save(os.path.join(path_tmp, "data.nii"))
  File "/home/forest/sct/spinalcordtoolbox/", line 311, in __init__
    raise ValueError("Image sform does not match qform")
ValueError: Image sform does not match qform

However, not all subjects had this error.

Hi @chang,

My apologies for the inconvenience. This is due to an issue that was identified in SCT v5.2.0 (link), and fixed in v5.3.0 (link).

Since you have already begun your analysis using v5.2.0, an alternative to upgrading would to add the fix yourself:

However, we recommend that you upgrade to v5.3.0 if you can, as it contains other bugfixes and improvements.

Kind regards,

Thank you for the response! Now there’s another problem
Due to automatic labeling did not work, I initialize with manual identification of C2-C3 disc.
when I ran sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -initlabel label_c2c3.nii.gz -qc ~/qc_singleSubj

Get z and disc values from straight label...
Traceback (most recent call last):
  File "/home/forest/sct/spinalcordtoolbox/scripts/", line 491, in <module>
  File "/home/forest/sct/spinalcordtoolbox/scripts/", line 403, in main
    init_disc = get_z_and_disc_values_from_label('labelz_straight.nii.gz')
  File "/home/forest/sct/spinalcordtoolbox/vertebrae/", line 297, in get_z_and_disc_values_from_label
    x_label, y_label, z_label = center_of_mass(
  File "/home/forest/sct/spinalcordtoolbox/vertebrae/", line 259, in center_of_mass
    raise ValueError("Array has no mass")
ValueError: Array has no mass

Hi @chang,

The “ValueError: Array has no mass” is also a known issue (see details here), which has been fixed in v5.3.0. So as @joshuacwnewton said we strongly recommend you upgrade SCT to v5.3.0.