Coregistering fail

Hi all!

I am trying to calculate the warping field from my T1 image to the template.
Since the automatic vertebrae labeling failed, I manually labeled the vertebrae.

When I enter all the disc labellings (3,4,5,6 and 7), I get an error, there are too many labellings.

Generate labels from template vertebral labeling

Check if provided labels are available in the template
Traceback (most recent call last):
  File "/home/affneu/evefra/sct_5.8/spinalcordtoolbox/scripts/", line 817, in <module>
  File "/home/affneu/evefra/sct_5.8/spinalcordtoolbox/scripts/", line 438, in main
    if labels[-1].value > labels_template[-1].value:
IndexError: list index out of range

I decided to only label three disc (e.g 3,4 and 7) and try coregistering again. But I constantly get this error, no matter which disc I label.

ERROR: Labels {6} were lost during straightening transform. This can be caused by the labels being outside the ROI of the spinal cord segmentation. Please make sure all labels are within the ROI of the spinal cord segmentation.

Hi @Evelyne

There could be multiple issues, I can think of:

  • label, seg and anat not being in the same space
  • label has additional values
  • syntax error

for me to reproduce your error and be able to help, i will need:

  • the anat, label and seg
  • the exact syntax you used


Thank you for the data. My 1st hypothesis was true: your label, seg and anat are not in the same physical space:

BTW: This mismatch of qform/sform between your anat and segmentation is likely what caused the automatic vertebral labeling to fail.