Problem with generating tensor image

Dear Mrtrix Users,

I used dwi2tensor dwi.nii -grad grade.txt dti.nii to generate the tensor image, But I didn’t understand why I’m having these results even when I’m using a mask image.
Could you please help me to resolve this issue?

Your help is well appreciated

Hello Abir!

Your question isn’t quite clear to me, what is it about your results that you don’t understand? If it’s about why the image in your screenshot includes values outside the brain, then you’re right that this would be because of a lack of mask image. You say you’re using one, but in the command you posted

there is no inclusion of a mask, that would require an additional argument like this: -mask mask.nii
Otherwise, nothing about your tensor image looks obviously wrong to me, although I wouldn’t usually view it as a main image in mrview… you can get a better sense of how your tensor image looks by using the “ODF display” tool.
If none of that is useful information, I’m afraid you’ll have to give more detail on what the problem is :slight_smile:


Dear Fiona,

Thank you very much for your answer,

This is the result when I used a mask image, what I can’t understand is the gray image that is projected on the DTI one, it may be right but can’t find an explanation.

Could you please help me to understand?

Thaks a lot.

Hi Abir

The image looks grey because the values range from negative to positive, with most values lying close to zero which gives a mid-grey appearance (see the colour bar in the bottom right corner). If you don’t like how this looks, try changing the contrast and brightness by adjusting the colourmap scaling (min and max values etc.).
It’s important to understand what information is actually contained in your DTI.nii file (see the documentation for dwi2tensor): It’s a 4D file containing the 6 unique coefficients of the diffusion tensor. In that screenshot, you’re just viewing the first volume, and the values on their own aren’t particularly meaningful. You may be expecting to see something like a fractional anisotropy (FA), or mean diffusivity (MD) image, which are a metrics derived from the DT. You can calculate FA and other DT metrics using the tensor2metric command, e.g tensor2metric DTI.nii -fa FA.nii.


Hello Fiona,

Thanks a lot for your helpful response, I can understand now,