Applying warp to tck file with tcktransform

Hi Mrtrix community,
I seem to be running into some trouble transforming tractography that was done in native space into MNI common space.
i am using a warp file made with fsl FNIRT. based on previous threads here, I used:

warpconvert warp_mni2diff.nii.gz displacement2deformation warp_def.nii.gz
tcktransform tracts warp_def.nii.gz tracts2template.tck

the result is not only not registered to the template image, but also seems to be pretty much the same as the original tracts, but with less tracts. Weirdly, the original tracts seem to fit the template better than the transformed ones.

the original tracts on the template:

the transformed tracts on the template:

obviously, I’m doing something wrong. I know the warp is fine because I used it to transform the template atlas to native space and it worked perfectly, so any input as to what is wrong in my process would be helpful.
thanks a lot in advance!

You have to use the inverse warp for transforming streamlines (explanation).

I’m trying to convert native to common space, and using the common to native transform. As far as I understand that’s the right one.


Yes, I think I got the wrong end of the stick…

This tripped me up. Did you use mrtransform for this? If not, the first check would be to transform the template image to subject space with mrtransform and the warp warp_def.nii.gz. I suspect this does not work.

Assuming your warp_mni2diff.nii.gz is the output of fnirt and you did not use mrtransform, I think you’ll need to convert that warp to MRtrix format as described in the docs. I’d not use warpconvert but use warpinit, use the fsl tool to warp these images (applywarp I think) and then use warpcorrect to sanitise the warp.

I have no experience with fnirt but you might not need to do the conversion and be fine with the warpconvert command depending on the image strides of the images used in fnirt (I’d try -1,2,3 first).

If my assumptions are off again, please provide the full commands you used.