Labels for lumbar spinal level

I have spinal cord lumbar images and I am trying to register to template (PAM50). I am aware of the subject variability for the vertebral correspondence. But I would like to generate the labels for this spinal level with sct_label_utils or sct_label_vertebrae. I was wondering which vertebral labels correspond exactly to the lumbar spinal level among the ones I can choose.
Otherwise, should I manually create them?

Thank you in advance!

Hello @iricchi,

Thank you for reaching out.

First of all, some clarifications about what each function does:

  • sct_label_vertebrae: Enables to automatically (or semi-automatically) obtain vertebral labeling. This function outputs a spinal cord segmentation, with values corresponding to the vertebral level.
  • sct_label_utils: This function is a tools for convenient manual labeling. For example, you can use it to create manually labels of intervertebral discs, as explained here.

So, none of these functions show you the actual spinal levels. To obtain the spinal levels, you have these two options:

  • Manually label them (using sct_label_utils) if your anatomical image shows you sufficient resolution and contrast to identify the spinal rootlets.

  • Use sct_warp_template -s 1, which warps the probabilistic spinal level location on your image. Please note however that the probabilistic model was built for the cervical cord (more details here), and we don’t guaranty the accuracy of this model in the lumbar cord.

1 Like

Thanks for your detailed answer but exactly for sct_label_utils I need to specify in the viewer option the numbers corresponding to the disks and I was wondering if they were existing for the corresponding lumbar disks and which ones they were.

The label values follow this convention. So for example if you are looking to create a label for the disc T12-L1, the value would be 20.

1 Like

I am using the same post I opened some months ago, since the topic is the same!

I have generated discs labels (till the 21st) and I have cropped both t2 and the segmentation to focus on the levels of interest. I have tried to run the sct_register_template (with standard parameters) but I get a very weird artefacts. Please have a look at the figure enclosed. Do you have any idea why this is happening? Thank you in advance!

Hi @iricchi

In order to understand the cause for this issue, could you please send me:

  • the data you used (image + segmentation + label)
  • the exact commands you used



Forgot to mention that I was using spine+CSF segmentation to try to help the registration (given the high variability of the lumbar levels).

Anyway, here you can find the data I used.

The command I was using is:

sct_register_to_template -i t2.nii.gz -s t2_seg_CSF.nii.gz -ldisc labels.nii.gz -c t2 -param step=0,type=label,dof=Tx_Ty_Tz_Sz:step=1,type=seg,algo=centermassrot,metric=MeanSquares,iter=10,smooth=2,gradStep=0.5,slicewise=0,smoothWarpXY=2,pca_eigenratio_th=1.6:step=2,type=seg,algo=bsplinesyn,metric=MeanSquares,iter=3,smooth=1,slicewise=0,gradStep=0.5,smoothWarpXY=2,pca_eigenratio_th=1.6:step=3,type=im,metric=CC

I also tried the standard parameters option simply:

sct_register_to_template -i t2.nii.gz -s t2_seg_CSF.nii.gz -ldisc labels.nii.gz -c t2

And as I wrote, I also tried to crop the image till the 21st disc but same output after the registration.

A few comments:

  • there is no need to manually crop the image because this step is already included in the sct_register_to_template function
  • you cannot use a CSF segmentation with the function sct_register_to_template unless you specify that the target segmentation used for registration is the CSF mask. This can be achieved with the special flag -s-template-id and selecting the value 6 (you can find this value with the command cat $SCT_DIR/data/PAM50/template/info_label.txt). Although in your case this won’t work because the CSF mask is only the CSF, whereas your CSF mask has the spinal cord and the CSF. So if you want to use this mask you would need to subtract your mask from the SC mask. But in any case, I don’t think this is the right approach for your data. Instead I recommend to stick with the SC segmentation.
  • The artifact you are seeing in Labels for lumbar spinal level is due to the fact that you used more than 2 labels with sct_register_to_template. When using more than 2 labels, a non-linear registration is first performed (corresponds to the step=0), meaning that SCT will align all the labels, and ignore what’s above the top label and below the bottom label. This results in the strange-looking image that you reported in your post. If you are only interested in the regions between the top and bottom label, then you don’t need to worry about this reconstruction artifact. If however you are interested in the regions outside, then you need to use a maximum of 2 labels.

Here is a piece of code that gets the SC segmentation and only keeps the top and bottom labels from your original label image that you sent (it had 5 labels in total):

# Segment the spinal cord
sct_deepseg_sc -i t2.nii.gz -c t2 -qc qc
# Only keep two labels
sct_label_utils -i labels.nii.gz -keep 17,21 -o labels_17_21.nii.gz
# Register to template
sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -ldisc labels_17_21.nii.gz -c t2 -qc qc -param step=1,type=seg,algo=centermassrot:step=2,type=seg,algo=bsplinesyn,metric=MeanSquares,iter=3,slicewise=0:step=3,type=im,algo=syn,metric=CC,iter=3,slicewise=0

It gives the following result, which is acceptable:

However, as you can notice more clearly in the QC report, the cauda equinea is not perfectly registered with the PAM50 template, because this registration is using intervertebral discs instead of the cord fiducial markers. If you are particularly interested in matching the location of the cauda equinea between your participant data and the PAM50 template, then you can create a label a ‘cauda equinea’ label in the PAM50 template and use that for registration. Demo here:

# Add a label of arbitrary value 99 to the PAM50 template at the start of the cauda equinea
sct_label_utils -i $SCT_DIR/data/PAM50/template/PAM50_label_disc.nii.gz -create-add 70,69,46,99 -o $SCT_DIR/data/PAM50/template/PAM50_label_disc.nii.gz
# Add the same label on the participant data
sct_label_utils -i t2.nii.gz -create 33,239,314,99 -o label_caudaequinea.nii.gz
# Use these labels to register to the PAM50
sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -ldisc label_caudaequinea.nii.gz -c t2 -qc qc -param step=1,type=seg,algo=centermassrot:step=2,type=seg,algo=bsplinesyn,metric=MeanSquares,iter=3,slicewise=0:step=3,type=im,algo=syn,metric=CC,iter=3,slicewise=0

This time, the registration of the lumbar cord is more accurate because now it is based on the cauda equinea (as opposed to the vertebral levels). Notably, the lumbar enlargement is now matching that from the PAM50 better than in the previous registration:

:information_source: Notice some image processing artefacts below the cauda equinea, which are caused by the straightening algorithm (because the cord segmentation has “holes” below the cauda equinea). These can be mitigated with a few approaches (eg: extrapolate the cord segmentation, change regularization parameters, etc.), but this is out of the scope of this post. And as mentioned before, if you are only interested in the cord (ie: above the cauda equinea), then that shouldn’t be a problem.

Hi Julien! Thank you so much!

  • Regarding the segmentation, I was basically summing (through fslmaths) CSF and cord segmentation (for T2) and, since we are loooking at fMRI too, it made sense to use CSF additionally to the cord because creating fMRI masks and segmenting functional imaging was easier in this way. So you would suggest for the purpose of registration to PAM50 to stick with spinal cord only anyway?

  • On sct_register_to_template, I thought I could use more than 2 labels for discs in particular. But, being interested in the regions also outside, I will need to stick to 2.

Thank you so much again! :slight_smile:

There is a lot of unknown for me (ie: how many contrasts you have, what are your hypotheses, what image quality of EPI scans, etc.) so it is difficult for me to advise exactly what to do. But for example, if your end goal is to register to the EPI scans to the PAM50 and your plan is to bypass the vertebral labeling, then you don’t need to go through the T2w registration and you can directly register the PAM50 template to your EPI scans.

Just to clarify: you can use more than 2 labels with sct_register_to_template. The only thing to keep in mind is that the region of interest needs to be encompassed between the top and bottom labels.

1 Like