Warping diffusion scan (not tensor) to MNI space

Hi MRTrix Experts,
I wanted to get your perspective on warping the subject space diffusion data (preprocessed but not the tensor file) to MNI space. I have calculated the affine and nonlinear components that warp the image to MNI template space and I have rotated the bvecs file according to the rotational-only contribution from the affine matrix to MNI template space using polar decomposition to get the rotational contribution from shearing. I was interested in warping the pre-processed subject space diffusion volumes to MNI space so that we can apply various post-processing tensor fitting methods (i.e. DTI, freewater DTI, DKI etc) using the same pre-processed inputs.

In reading, I see where there are issues warping the tensor file itself in that you must first warp the tensors and then (similar to the ANTS implementation) reorient the tensor based on voxel-wise local deformations.

  1. Do you see this as a major issue when warping the diffusion data as opposed to diffusion tensor prior to fitting using the method I described above?

  2. If it is still an issue does MRTrix or other program you are aware of allow you to enter a voxelwise bvector map per volume instead of bvector file for fitting the tensor?


Hi Ajay,

There are fundamental physical limitations in the spatial transformation of diffusion-weighted image data. This is over and above the technical complications of gradient table reorientation and per-voxel gradient tables: it is not possible to know how the diffusion-weighted data should be modulated based on that transformation, without invoking some model. The FBA pipeline in MRtrix3 is based around spatial transformation of FOD data for this reason.

Theoretically, if you really wanted subject-specific DWI data in template space, you could transform multi-tissue-CSD data to template space (preferably based on multi-tissue registration), with appropriate modulation & reorientation, and then perform a spherical convolution to obtain the predicted DWI data in template space. However doing so in order to finally perform a tensor fit would seem self-defeating to me personally.

It’s more common to just calculate those voxel-wise metrics on the subject-specific voxel grid, and then non-linearly transform each individually to template space, because it dodges this issue.

If it is still an issue does MRTrix or other program you are aware of allow you to enter a voxelwise bvector map per volume instead of bvector file for fitting the tensor?

If you really wanted to go down this road, FSL’s dtifit accepts a gradient nonlinearity tensor file; it should be possible to derive appropriate data for such based on a non-linear transformation, if you’re not averse to doing some algebra.


Hi Rob,
Thanks for your feedback, I was also concerned that something like Jacobian modulation (done in VBM) may not be accurate for diffusion data when warping to MNI space which is why I haven’t gone down this route yet and wanted to get your thoughts.

I see the argument for just applying the warp field to the subject space metrics (FA, MD etc) which works for scalar maps, however I was also interested in applying the warps to tractography within MRTrix as well as AFQ. Specifically I have created warps to MNI space using AFNI as it works better in my patient population, which creates a deformation field from the target to the source data (similar to ANTS). I have a few questions as I would like to implement these warps in MRTrix:

  1. Similar to ANTs, I get the displacement field in mm shift in the X, Y , Z from the target to the source. AFNI convention is that the deformation field is always in R->L, A->P, I->S orientation (or LPS per MRTrix convention) , regardless of how the DWI data is stored (PAR, RPI etc). Is this similar to MRTrix/ANTs or would I have to do some orientation conversion to have either the template or DWI data (or both) as well as the deformation in the same orientation in order to use my warp field within MRTrix?

  2. If I have an affine and nonlinear warp concatenated into a single deformation file, does the fixelreorient script run the ANTS ReorientTensor algorithm or is this something different for the fixel-based analysis?

  3. For warping the DTI tensor ANTS (I also assume MRTrix) warps the tensor in log space and then reorients the result as a two stage process. For DKI fitting (which MRTrix uses dwi2tensor) would the same apply (warp in log space)? Also does ReorientTensor or fixelreorient work with DKI tensor data calculated within MRTrix? Or would I just warp the scalar maps in this case?


I was also interested in applying the warps to tractography within MRtrix

Streamlines data can be transformed via a non-linear warp field; see command tcktransform.

  1. In addition to the LPS vs. RAS convention, you will also need to check whether the field represents displacement or deformation data. The former encodes changes in position relative to the location of that voxel, whereas the latter encodes an absolute location in space from which data should be sampled for that voxel. warpconvert can convert between these two, but will likely do the wrong thing if the LPS / RAS discrepancy is not first addressed.

    In the absence of anybody else providing insight from their experience with AFNI specifically, you’ll need to check your own data very closely in order to infer what manipulations are required. In addition to warpconvert, you can if necessary negate values for specific axes using a combination of “mrconvert <image> -coord 3 #” and “mrcalc <image> -1 -mult”. You could also try “mrconvert <image> -strides -1,-2,3,4” on the DWI data prior to using AFNI and see whether it changes the output or makes the requisite steps any less ambiguous.

  2. fixelreorient does not depend on ANTs, nor is it related to tensor reorientation, which requires dedicated calculus. Reorientation of a single direction is in fact exceptionally simple.

  3. MRtrix3 does not support appropriate nonlinear warping of tensor data, with or without kurtosis coefficients. Only scalar and FOD data can be transformed. Tensor data would be accepted as a valid input by the mrtransform command and it will produce a warped output, but this will only be each individual volume transformed individually, it will not utilise the appropriate mathematics given the nature of the data contained in the input image.


1 Like