First: Thank you for creating and sharing for free such a great set of tools. I have recently started using MRtrix and I find it very useful indeed.

My question:

I have been experiencing difficulty figuring out the correct signs and orderings for my diffusion data and gradient tables. I have read several related posts on this forum, but I am still confused with some of my observations.

Let me present a simple example.

I take a diffusion scan from an HCP dataset. It comes with bvec/bval files. I reconstruct diffusion tensor images in three different ways:

1- dwi2tensor, where I pass the original bvec/bval files with -fslgrad.
2- dwi2tensor, where I first write the bvec/bval files to a .txt file and pass it with -grad.
3- I use a simple least-squares solver to compute the diffusion tensor for each voxel.

Now, I display these three tensors using mrview and DTITKβs TVglyphView. Here are the results:

mrview: 1 is OK; 2 and 3 are flipped.
TVglyphView: 2 and 3 are OK; 1 is flipped.

*** Why should dwi2tensor care whether I pass the gradient table using -fslgrad or -grad?
*** Since this is an HCP scan (pre-processed by the HCP people), I assume no further pre-processing would be required. Is that a wrong assumption? Why should mrview display my DTI reconstruction (estimated with a basic least-squares solver) as flipped?
*** Why should two visualization tools (mrview vs. TVglyphView) display opposite results? After all, this is just visualization.

The gist of it is that MRtrix (and hence the -grad option) assumes all vectors (e.g. diffusion gradient directions, tensor eigenvectors, fixels, β¦) are provided with respect to real or scanner coordinates, whereas FSL (and hence the -fslgrad option) assumes all vectors are provided with respect to the image axes.

So when you are writing bvec/bval files (which is FSL format) straight to a text file and pass it to dwi2tensor with the -grad option you are actually ignoring these assumptions.

Because of that, it is perfectly sensible that only case 1 looks ok.

The correct way to convert between both gradient formats would be:

In fact, the most sensible approach is to convert from FSL (.nii + bvecs/bvals) to MRtrix format (.mif) once and then stick to .mif for all subsequent MRtrix commands:

mrconvert dwi.nii -fslgrad bvecs bvals dwi.mif β gradient table is now stored correctly in the header of dwi.mif

dwi2tensor dwi.mif dt.mif β gradient table is read correctly form the header of dwi.mif

This depends entirely on how your routine interprets the gradient table. You are probably reading the gradient table directly from FSL-style bvecs, resulting in your tensors and tensor eigenvectors to be calculated with respect to the image axes rather than with respect to real or scanner coordinates. As MRtrix assumes all vectors are provided with respect to real or scanner coordinates, this will cause your tensors or tensor eigenvectors to be oriented in the wrong way when viewing with mrview.

Because these two tools make different assumptions about the coordinate frame used to represent vectors.