After I preprocessed all my subjects. I’m trying to align my dwi data to the t1.
I did that following the steps from the tutorial but it’s not giving me any good results. I’m hoping I did something very simple wrong and I’ve been trying to figure out the problem, but so far no success.
What I did:
flirt -in mean_b0.nii.gz -ref T1.nii.gz -interp nearestneighbour -dof 6 -omat diff2struct_fsl.mat
transformconvert diff2struct_fsl.mat mean_b0.nii.gz T1.nii.gz flirt_import diff2struct_mrtrix.txt
mrtransform T1_5ttgen.mif -linear diff2struct_mrtrix.txt -inverse T1_coreg.mif
I extracted the mean_b0 from the preprocessed dwi image and I’m trying to align the 5ttgen (which I got from the T1 image).
The result I get:
As you can see, not very well aligned
I’m hoping someone can tell me where I’ve went wrong …
There are some things you could try to improve your results:
- flirt works better with skull-stripped images, so if you have good masks for your B0 and T1w image, this could improve the registration.
- Why are you using in the flirt call -interp nearestneighbour? this suggest that the moving image is a label mask or something similar, you want to register the T1w with the B0.
- Finally, you could also add the flag -cost normmi to the flirt command, since you are doing an inter modality registration.
I would also check to be sure than the 5tt and T1w image you are using to drive the registration are aligned. I hope this helps.
Thanks for your reply!
My 5tt and T1 are perfectly aligned, I checked that .
I already had a skull stripped B0 image but the T1 not yet, this indeed improved the alignment a lot!
I left out the -interp flag and used the one you suggested. After this I got the following image:
As you can see, it improved a lot but it’s still a bit off around the ventricles. I tried to run it without the -cost normmi flag and it gave me an even better result:
On some places it is slightly off, but I don’t know what the consequences are of that? And maybe good to mention that my subjects are +/- 10 year olds, maybe that has something to do with it as well?
Good to know, that the results are better now. I think the processing should be the same for a 10 years child that for a baby, probably they have more movement but I believe all the processing steps to apply are the same.
What you could try is to do a boudary-based registration (paper). If you have a WM mask (you can obtain it for example using the 5ttgen script with the
-nocleanup flag, or just by running fast in your T1w):
The command lines will be something like this:
flirt -in mean_b0.nii.gz -ref T1.nii.gz -dof 6 -omat diff2struct_fsl_initial.mat
flirt -in mean_b0.nii.gz -ref T1.nii.gz -dof 6 -cost bbr -wmseg WM_mask.nii.gz -init diff2struct_fsl_initial.mat -omat diff2struct_fsl_bbr.mat -schedule /usr/share/fsl/5.0/etc/flirtsch/bbr.sch -out diff2struct.nii.gz (if you are not happy with the diff2struct.nii.gz image, try to add the flag -bbrslope 0.5)
transformconvert diff2struct_bbr.mat mean_b0.nii.gz T1.nii.gz flirt_import diff2struct_bbr_mrtrix.txt
mrtransform T1_5ttgen.mif -linear diff2struct_bbr_mrtrix.txt -inverse T1_coreg.mif
Basically is the same as before, but adding one extra step in the middle. This usually results in improved co-registrations.
Thanks for this helpful information. May I ask another question about registration? Should I use the b=0 image to register to the T1-weighted anatomical image, or the average of diffusion-weighted images to register to T1 image? What are the pros and cons for each case, assuming that DTI has been pre-processed and 6 degrees of freedom is used for registration.
By the average diffusion weighted do you mean all the b values different from 0? In case of multi-shell data do you refer to only one b-value or to all of them? I would advise against averaging different b values, as they have different contrasts.
I usually use the average of all the b0 to increase the SNR, but I don’t think it would be a big difference using only the first b0. The approach of using the average b0 is extended in the literature, but depending of the characteristics of your data, maybe you want to consider using a bvalue different from 0 (see here for an example).
I have found the epi_reg script provided by FSL to perform very well in this situation (https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FLIRT/UserGuide#epi_reg).
# Note that you can add the arg: --wmseg=wmseg if you have a better segmentation (e.g from spm)
epi_reg -v epi=b0_mean --t1=t1 --t1brain=t1_bet --out=epi_reg
epi_reg takes advantage of a different registration technqiue called boundary-based recognition which seems to perform much better in this situation (https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FLIRT_BBR). It is a script (not a binary), so feel free to open it up to see exactly what it’s doing.
You’ll need to apply the resulting transform matrix to your dwi data
flirt -ref t1 -in dwi -applyxfm -init epi_reg.mat -out dwi_coreg