I am currently working on a reproducibility study, and I scan the same subject 1-2 weeks apart. For my study, I need to create a cervical spinal cord ROI that is the same for both scans. To do this, I am trying to register the t2 image from the first scan to the t2 image from the second scan and then segment the registered images.
I have been playing around with different parameter arguments and have gotten okay registration results using labels but it’s still not perfect. The command that I am currently using is as follows:
Before giving a full answer, I just wanted to mention that the data archive above seems to be missing the file “mask_t2.nii.gz” (as referenced in the command above). Could you please share this file as well?
Sorry for the late reply. While working on a solution, we discovered this bug, which is now fixed. So, to be able to use the proposed solution below, you will need to install the development version of SCT (“master” branch). If you are already working with the development version, you just need to go in SCT’s repository and run:
git pull
So, here is the proposed solution. The idea to register two scans that are acquired at two different sessions is to use the disc labels as a first ‘approximate’ registration, and then use the spinal cord segmentations for the refined registration. Here is the command:
When running with flag -v 2, it outputs intermediate registration results. An interesting one is the label-based registration, showing the source (red), destination (green cross) and registered (blue) disc labels:
I am also trying to register anatomical T2 images from 2 different sessions. For I’d say half of the participants, your suggested parameters work very well. But for a lot of images, the output spinal cord appears ‘twisted’ in the XY plane. This is the command I’ve been using to register my POST to my PRE session :
I’ve tried different rotation methods, of which pcahog is the best, but still not quite satisfactory towards the cauda equina. Here is a gif showing 3 ouputs when trying :
1/ centermassrot (imseg type) algorithm with pcahog
2/ centermassrot (imseg type) algorithm with hog (equivalent to default pca in terms of twisted output),
3/ centermass (seg type)
I have also tested the other algorithms without any luck. Do you have an idea on how to handle this registration ? Here are the files to test it if you’d like.
@raphaschl, I’ve tried a couple of combinations, but unfortunately I was not able to obtain a satisfactory co-registration between the two scans. Here is a QC of my investigations. I’ve notably tried to re-segment the spinal cord using the latest deepseg model, but it didn’t completely solve the issue.
I have some ideas to improve the co-registration, notably by revisiting the HOG algorithm, using mask around the cord, but it would require me spending a significant amount of time to implement these new features, and unfortunately I do not have that time right now.
Hey, I also realized that when implementing a first step based on vertebral labels with the parameters you mentioned : step=0,type=label,dof=Tx_Ty_Tz_Rx_Ry_Rz, the code outputs :
Parameter ‘algo=syn’ has no effect for ‘type=label’ registration.
It seems this message appears for all algorithms, and the labels are still taken into account, is this normal ?
Hi ! I think we’ve found a solution : @jsein suggested trying the niftyreg package, and initializing the non-linear registration with an affine transform beforehand. It works like a charm ! I will try and see if it works for all the participants I’ve had trouble coregistering.
# linear registration post 2 pre
reg_aladin -ref sub-CTS05_ses-SPpre_T2w_crop_08iso.nii.gz -flo sub-CTS05_ses-SPpost_T2w_crop_08iso.nii.gz -res sub-CTS05_ses-SPpost_T2w_crop_inrefanat_niftyreg.nii.gz -aff affinetrans_sub-CTS05_ses-SPpost_T2w_crop_inrefanat_niftyreg.txt
# non-linear registration post 2 pre, initialized with the linear affine transform
reg_f3d -ref sub-CTS05_ses-SPpre_T2w_crop_08iso.nii.gz -flo sub-CTS05_ses-SPpost_T2w_crop_08iso.nii.gz -res sub-CTS05_ses-SPpost_T2w_crop_inrefanat_niftyreg.nii.gz -aff affinetrans_sub-CTS05_ses-SPpost_T2w_crop_inrefanat_niftyreg.txt -cpp cpp_sub-CTS05_ses-SPpost_T2w_crop_inrefanat_niftyreg.nii
I agree. I’ve just tried these commands and the registration quality is excellent. Thank you for sharing @raphaschl !
I would just be careful with the non-linear registration, which seems to be highly sensitive to bias field, and generates spurious deformation. See below (SPpre, SPpost_aladin, SPpost_aladin-f3d)
Yes noted ! The above commands worked on all subjects but one. For it to work on that tricky subject, we added -nac -ln 12 -lp 10 to the reg_aladin command, as follows :
Also, the version of niftyreg used seems quite important : with a 1.3.x version, these parameters still didn’t help. But after updating to 1.5.7 on Unix, the output was really satisfactory ! And interestingly, slightly different (I would say not as good) as with @jsein’s 1.5.30 version on Mac.
On a complementary note, when using niftyreg v1.5.69, as it is available on NeuroDesk, identical results are obtained as with niftyreg v1.5.30 on a mac.