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:
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.
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!
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.
I have a set of streamlines in individual subject spaces which I would like to register into a group template space. I created a group template of my 30 subjects’ FA maps using the population_template command. This command created a template file (which looks good), and folders for linear_transformations, transformed images and warps.
I’m not too sure on the commands to be used for the step of actually registering individual subjects’ .tck files into the group template space. I tried tcktransform as above, but for some reason I don’t seem to have it installed! I checked which version of MRtrix I have by running mrconvert -version, which shows:
== mrconvert 3.0_RC2-117-gf098f097 ==
Which is obviously a little off. Do I need to also apply the linear transformation .txt generated by the population_template command? If so - how do I go about this as I understand mrtransform can only apply linear transformations to images, not track files.
Secondly - it looks like there are a few erroneous streamlines introduced during this step (straight lines with no anatomical basis):
For each subject, then ran tckgen to create streamlines for cerebellar projections. These are in /dti/frontal_parc/tckgen_l_drtc_rnmask_5mseeds_bi.tck
Then ran (for one example subject shown above, C01): tcknormalise <C01_dir>/dti/frontal_parc/tckgen_l_drtc_rnmask_5mseeds_bi.tck ~/Desktop/data/ctrl/frontalparc/ctrl_template_t1Brain/warps/C01.mif C01_l_drtc_warped.tck, resulting in the above snapshots.
Hope this makes sense. Let me know if there’s any more info you need.
I am surprised that does not throw an error or at least a warning. The warps produced by population template are actually 4 warps (“warp_full”) stored in one 5D file, you’ll need to convert this to a single deformation field from template to subject space and apply that warp to tcktransform. I think the following should work:
That means your version is older than Aug 2017, probably best to update (ac7e73576bec4).
I think there is a mistake in my command: -from 1 should have been -from 2. Please see here for a full worked example and adjust the relevant commands to your data.
Also, this assumes that subject FOD image and subject T1 are aligned (please check with mrview <your subject T1> -overlay.load <your subject FOD> -overlay.opacity 0.3)? If not you need to concatenate the transformation from DWI to T1 to T1 template (feed the output of warpconvert and the linear transformation from T1 to DWI data into transformcompose, in that order and use the DWI image as -template argument). As a sanity check, you should be able to use the resulting warp to transform the T1 template to subject DWI space (mrtransform). You can debug this step by step by warping the streamlines twice, once from subject DWI to subject T1 space (by generating a linear warp field), then to T1 template space using the output of warpconvert.
Thanks for that last bit of advice - that did it. I was trying to put them into T1 template space, which just confused things. Using the commands provided above it was relatively straighforward to warp the SLs into group FA space.