Result of dwi2tensor is different from FSL

Hi dear experts. I’m a new user of MRtrix. I have three tensor images for a DWI image: 1. my WLS code 2. dtifit command(FSL) 3. dwi2tensor command.
I compare these images by the mrview command. The direction of tensors in the 3rd image (the result of MRtrix) differs from the direction of tensors in the 1st and 2d images.
I don’t know why they are different.

1 Like

Hi @Somaye_Jabbari – and apologies for the late response.

The differences you’re seeing seem to arise from different conventions around the coordinate system. The tensor components are implicitly provided with respect to some coordinate frame, and if there is a mismatch between the convention assumed by the program generating the tensor coefficients and the program displaying them, you will see problems like this.

In MRtrix, all tensor coefficients (and directions, SH coefficients, DW gradient directions, etc) are assumed to be provided with respect to real / scanner / world coordinates. Other packages tend to provide these kinds of directional outputs with respect to the image frame (i.e. the axes of the NIfTI image they correspond to) – I believe this includes FSL.

I’m sure there are ways of converting between the two, but unless the images happen to be perfectly axial (i.e. with no rotation of the imaging plane), then that would require a bit of coding and validation. If they are pure axial, however, it might be enough to simply negate all the x components of your tensors (since FSL tends to implicitly rely on the old Analyze frame, where x runs right to left, the opposite of the newer NIfTI standard, and the opposite of MRtrix).

You might be able to do this by splitting your tensor images into separate volumes (disclaimer: this is totally untested code):

mrconvert dti.nii dti-[].nii

then inverting the relevant components, which will probably be volumes 3 (Dxy), and 4 (Dxz) – though this requires thorough validation:

for c in 3 4; do
  mv dti-$c.nii tmp-$c.nii
  mrcalc tmp-$c.nii -neg dti-$c.nii

at which point you should be able to recombine them into a single NfTI again:

mrconvert dti-[].nii dti-flipped.nii

All the best,

[EDIT: updated since it should not be required to invert the Dxx term]

1 Like

Thanks a lot.
You described well and the solution worked fine.