Affine registration using sct_register_multimodal

Hello,

I’m currently trying to use sct_register_multimodal to perform affine registration between cropped MRI images from the Spine Generic Dataset and their segmentations.

I have a few questions regarding my understanding of sct_register_multimodal and how I can use it to generate my desired output:

  1. sct_register_multimodal uses a destination image to which the source image is registered to. Why does it output a registered file of the destination file (transformed w.r.t. the original destination image)?
    For example: If I register my entire dataset to a base image (in this case “sub-amu01-T1w.nii.gz”), each image registration generates a new registered output of the base image (“sub-amu01-T1w_reg.nii.gz”). Are the output registrations of the source image being registered to the base image or new registered output of the base image?

  2. I’m not sure if I am using the correct parameters for this process. Is what I did correct to get a pure affine registration? Does it make sense to have two steps?
    sct_register_multimodal -i ~/workspace/cropped_spinegeneric/cropped_reshaped/sub-amu02_T1w.nii.gz -iseg ~/workspace/cropped_spinegeneric/cropped_reshaped_seg/sub-amu02_T1w.nii.gz -d ~/workspace/cropped_spinegeneric/cropped_reshaped/sub-amu01_T1w.nii.gz -dseg ~/workspace/cropped_spinegeneric/cropped_reshaped_seg/sub-amu01_T1w.nii.gz -param step=1,type=im,algo=affine,metric=MeanSquares:step=2,type=seg,algo=affine,metric=MeanSquares

  3. I also want the affine registration of the segmentations. Is there a way for sct_register_multimodal to do that transformation as well? Or will I have to use the output warp file with sct_apply_transfo? If I do have to use sct_apply_transfo, would the command look something like this:
    sct_apply_transfo -i "sub-amu02_T1w_seg.nii.gz" -d "sub-amu01_T1w_seg.nii.gz" -w "warp_sub-amu03_T1w2sub-amu01_T1w.nii.gz"

Any pointers would be greatly appreciated!
Thanks,
Jonathan

1 Like

Hi Jonathan,

Are the output registrations of the source image being registered to the base image or new registered output of the base image?

The registration is a diffeomorphic process, ie, they are both coregistered together, and applying the forward+backward to the source image (or the backward+forward to the destination image) should give you almost the same image (not counting interpolation errors of course). As such, we thought that outputting the registered ‘destination’ file could be useful for some users.

I’m not sure if I am using the correct parameters for this process. Is what I did correct to get a pure affine registration? Does it make sense to have two steps?

There are a couple of issues with this:

  1. amu01 and amu02 are not the same subject, hence an affine transformation is not appropriate to properly register these two images. Moreover, without masking, an affine algorithm will probably use the edge of the head/neck for the converging transformation (but maybe this is what you want)
  2. Starting with the im and then the seg is strange, because the seg will give you more robust pre-alignment.
  3. MeanSquares is ‘dangerous’ with two images from different acquisitions-- eg: if the DICOM image quantization scaling factor differs (because, eg., the signal histogram vary across the two images, which is likely the case), the metric won’t do what it is supposed to do

I also want the affine registration of the segmentations. Is there a way for sct_register_multimodal to do that transformation as well?

Yes. A segmentation is an image, except that the information content is a binary object. So you can always register two binary objects together (the same way you do it with ‘real’ images).

Hi Julien,

Thanks for the pointers. Just wanted to follow up on a couple of your comments:

To give a little more context, I only want a rough affine alignment as a pre-processing step for further registration in a different pipeline. Please see below for an example of my cropped images from Spine Generic (show C2 - ~C6). I want to affine align all (cropped) images in Spine Generic to the cropped sub-amu01 image as the destination.
image
sub-amu01
image
sub-amu02

Im not sure what you mean by “forward+backward”/“backward+forward”. Is this referring to the transformation/warp field generated?

Should the mask used in sct_register_mulimodal be for the source or designation image? Do you have any recommendations on parameters used in sct_create_mask to get the best output for this application?

I want the segmentations to be identically affine aligned to the segmentation’s counterpart image. ie, The segmentations should be transformed the same way the images were. This would require sct_apply_transfo using the output warp field right?

Thanks,
Jonathan

1 Like

yes

Destination, because the first step (hidden: step=0) bring src to dest using the NIfTI qform affine transfo.

If your plan is to do a coarse alignment of the cords and you already have the segmentations, then my recommendation is to not use the images at all, but only the segs, and then apply the output affine transformation on the images.

right, although as per my comment above, you would do the other way aruond, ie: apply the transformation (obtained using the segs) to the images.

1 Like

Hi Julien,

Thanks for the support! I ended up getting the affine registration to work on the spinal cord based on the segmentations. A next step on my project is to get the vertebral bodies affine aligned too. Any ideas on how I might be able to do that on the cropped images without labels of the vertebral bodies?

One method I was thinking about (if SCT can’t do that affine alignment) is getting the centroids of the vertebral bodies and using 3DSlicer to do the affine registration based on the centroid locations. I know sct_label_vertebrae will generate the vertebra labels on top of the spinal cord segmentations, but is there something that can generate vertebral body centroids?

Thanks,
Jonathan

Hi,

Exactly the same way: simply apply the affine transformation (the one you obtained from the segs, and that you applied to the images) to the “*seg_labeled” file obtained with sct_label_vertebrae

1 Like