Vertebral alignment to template


HI Julien & the SCT team,

I was hoping you can shed some light on how sct_label_vertebrae and sct_register_to_template deal with vertebral alignment.

Test case - if I notice that vertebral labelling has failed with sct_label_vertebrae I’ve switched to using -discfile where I can explicitly input the locations of discs 3->9 and avoid having the program try to detect them. This seems to solve most of our problematic registrations. Is this in any way comparable to using the -ldisc option in sct_register_to_template? I.e. can you “force” vertebral alignment using this option?

From the London course material (p61):

However, if your volume spans a large superior-inferior length (e.g., C2 —> L1), the
linear scaling between your subject and the template might produce inaccurate
vertebral level matching between C2 and L1. In that case, you might prefer to rely on
all inter-vertebral discs for a more accurate registration:

sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -ldisc t2_labels_disc.nii.gz -c t2

The reason I ask is that in some cases (particularly EPI to template registration) we have some issues with vertebral alignment. From looking at the London course material (p47) it seems that under normal circumstances vertebral alignment is dealt with by an affine transform - would this step be ignored if forcing alignment (as per above)?

I was wondering whether affine registration can fail in the case of age-related spinal degeneration as you might find e.g. that the C5 vertebra is smaller than the others, so a linear transform would not be able to cope with this? Although in general there must be quite a bit of variation in the disc to disc spacing in the general population, so I guess this problem must be broader than just age-related change.

Sorry for the rambling brain burp.

Best wishes,



Hi Jon,

As you rightly figured out, if vertebral labeling fails, you can manually identify intervertebral discs and use the -ldisc flag (instead of -l) with sct_register_to_templatefunction.

Now, regarding when affine (as opposed to non-affine) transformation is used, below is an excerpt from sct_register_to_template -h (I know the documentation is quite confusing, we are working on it :slight_smile: ):

  If only one label is provided, a simple translation will be applied between the subject label and 
    the template label. No scaling will be performed. 
  If two labels are provided, a linear transformation (translation + rotation + superior-inferior 
    linear scaling) will be applied. The strategy here is to defined labels that cover the region
     of interest. For example, if you are interested in studying C2 to C6 levels, then provide one l
    abel at C2 and another at C6. However, note that if the two labels are very far apart (e.g. C
    2 and T12), there might be a mis-alignment of discs because a subjects intervertebral discs
     distance might differ from that of the template.
  If more than two labels (only with the parameter "-disc") are used, a non-linear registration 
    will be applied to align the each intervertebral disc between the subject and the template,
     as described in sct_straighten_spinalcord. This the most accurate and preferred method. This 
    feature does not work with the parameter "-ref subject".

So to sum up, if you provide three labels or more, then affine transformation is bypassed and disc alignment is done using a bspline function along the superior-inferior direction (where each node of the bspline is a disc).



Hi Julien,

Thanks for taking the time to explain that - much appreciated!

Just one last thing, if I’ve previously used sct_label_vertebrae to create a foo_seg_labeled.nii.gz file, which also created a foo_seg_labeled_discs.nii.gz file, is it “safe” to use this as my input for -ldiscs (as the labels are projected onto the cord centerline, not at the posterior edge of the disc - as if done manually)?

FYI using this pipeline (-ldisc with foo_seg_labeled_discs.nii.gz from sct_label_vertebrae) seems to give pretty much perfect disc alignment between subject structural and template.

Best wishes,



Hi Jon,

you can do it both ways. Even when making manual labels at the posterior edge of the disc, within sct_register_to_template there is a routine that projects the labels orthogonally onto the cord centerline.



Phew - that saved me a lot of time.