Summary of what happened:
Hi all,
I am trying to transform some native-space statistical images (FEAT outputs) into MNI space for ROI analysis. Because they are stats images, there isn’t a ton of registration markers to do a direct transformation, so I am trying to use fsl applywarp with T1-to-MNI transformations instead. The applywarp outputs are definitely not right so I am reaching out to the experts for some assistance.
Any recommendations for improving the registration are welcome - my PI prefers to do initial analysis in native space rather than MNI, and perform the template space transformation on the “final” post-processed stat image.
Command used (and if a helper script was used, a link to the helper script or the command generated):
flirt → fnirt → applywarp
Input is an fmriprep-preprocessed T1w image
flirt -in T1.nii.gz -ref MNI152_T1_2mm.nii.gz -dof 12 -out T1toMNI_lin -omat T1toMNI_lin.mat
fnirt --in=T1.nii.gz --ref=MNI152_T1_2mm.nii.gz --aff=T1toMNI_lin.mat --iout=T1toMNI --cout T1toMNI_coef --fout=T1toMNI_warp
applywarp -i stats-image_T1-space.nii.gz -r MNI152_T1_2mm.nii.gz -w T1toMNI_warp.nii.gz -o stats-image_MNI-space.nii.gz
Screenshots / relevant information:
Running these commands results in a final image that looks like this:
While the “T1-space” input looks like this:
Version:
fsl-6.0.3, via LPC computing cluster
You will need to check whether the linear and non-linear registrations succeeded - to do this you can:
- Use
flirt -applyxfm
to linearly transform your T1 image into MNI152 space. If the result overlays nicely when you open the transformed T1 and MNI152 images, then the linear registration succeeded. If not, you will need to adjust the input options to flirt
- Open
T1toMNI.nii.gz
in FSLeyes, overlaid on the MNI152 template. If the FLIRT registration was good, but this image it is not aligned, then the problem is with the non-linear registration.
Usually when calling fnirt
you will get best results by using a suitable configuration files from $FSLDIR/etc/flirtsch/
- for T1 to MNI152 registrations you should be running fnirt --config=T1_2_MNI152_2mm ...
Hi Paul,
Thanks for the information. I should I have included it in the initial post, but I did confirm that the T1-to-MNI registrations were good. It is just the EPI-based stats image–to–MNI piece that is failing. I will try using the config flag for FNIRT and see if that helps.
Any suggestions for getting the stats image to align to MNI using the transformations once they’re confirmed to be good? Here is the stats file overlayed with original T1 image for reference:
T1-to-MNI FLIRT:
T1-to-MNI FNIRT:
Aah, so it looks to me like your stats image is in EPI space, which is much lower resolution than your T1 image - even though they’re aligned in FSLeyes, they’re different spaces - the resolution and field-of-view will affect the application of FLIRT/FNIRT transformations.
Have you previously calculated a linear transformation from your EPI image to your T1? If so, you can create an EPI → MNI152 warp with convertwarp
, e.g.:
convertwarp \
--ref=MNI152_T1_2mm \
--premat=EPItoT1.mat \
--warp1=T1toMNI_warp \
--out=EPItoMNI_warp
1 Like
Ah, yes that would make sense. I hadn’t considered the FOV of the stats image.
As for EPI-to-T1 registration, I am using fmriprep for functional preprocessing. I see within the derivative folders, there is a boldref-to-T1 coreg xfm file for each different acquisition containing:
#Insight Transform File V1.0
#Transform 0
Transform: AffineTransform_float_3_3
Parameters: 0.997372 0.0658842 -0.030148 -0.0683623 0.993565 -0.0903037 0.0240045 0.0921267 0.995457 -3.93677 8.86301 -4.43133
FixedParameters: 0 0 0
How would I make this work with something like convertwarp?
There isn’t anything in FSL that can do this, but there are a couple of other tools that you can use to convert an ITK affine to a FSL FLIRT affine:
Or if you could share your stats and T1 images with me, I could figure out a workflow (I’m curious about whether there’s an easy way of doing this, as I can’t find a comprehensive explanation of the ANTS/ITK format available online).
Hi Paul,
Thanks again for your suggestions. I had access to the MRtrix package, so I tried converting the boldref-to-T1w fmriprep transformation using that.
It generated a transformation that FSL accepted (no errors or crashes) but it did result in a not-so-correct outcome:
Seems like maybe there’s a problem with the handedness? Or the origin? Not really sure at this point as the boldref image has the same resolution as the stats image, and both are trying to be registered to the same T1.
I’d be happy to share some of these images with you to test out. For now, I’m kind of at a loss.
Hi @jdickson14, sure - if you can share your data somewhere online (e.g. google drive), then send me a link - if you prefer, you should be able to send me a private message via the Message button after clicking on my profile picture.