Difffusion gradient values and skull stripping

Hi All,

I am trying to obtain FA values for my DTI image.

In order to do that, I am converting my DTI image to tensor image using dwi2tensor.

But prior to doings this; I skull strip my image in FSL using BET.

This skull stripped image is the one I would like to generate FA values for.

But, because of the skull stripping operation I am losing diffusion gradient table.

I have also separately called -grad grad.b or -fslgrad bvecs and bvals; obtained from the original DTI image before skull stripping. But it still complains lack of diffusion gradient table.

dwi2tensor skullstrip_dcorr_DTI_P2.mif dtensor_dCorrection.mif
dwi2tensor: [ERROR] no diffusion encoding information found in image "skullstrip_dcorr_DTI_P2.mif"

I was wondering, if MRtrix contains function for skull stripping and if not how to overcome this error for skull stripped image.

Kind regards.

Hi @isAarya,

You should probably give dwi2mask a go. This will compute a mask image from your original DWI data, which you can subsequently provide to dwi2tensor via the -mask option. In that way, the tensors will only be computed within the brain mask, and the computation of any subsequent metrics (such as FA) will be limited to that region as well.


Thanks. It worked

1 Like

Just to follow up on that: the idea is to generate a mask image that is then passed to dwi2tensor using the -mask option. But you seemed to be applying the mask directly to the DWI series? That would explain why the gradient table got stripped out - normally the DWI shouldn’t be modified at all…

Regardless, if you had tried to insert the gradient table back into your skullstrip_dcorr_DTI_P2.mif image using e.g.:

$ mrconvert skullstrip_dcorr_DTI_P2.nii -grad grad.b skullstrip_dcorr_DTI_P2.mif

then that should have worked. As should a direct invocation of dwi2tensor using the -grad option, e.g.:

$ dwi2tensor skullstrip_dcorr_DTI_P2.mif -grad grad.b dtensor_dCorrection.mif

If these commands didn’t work, then we’d need to fix that. Can you confirm that this is what you’d tried? These commands seem to work fine on my system…


I wanted to use my own skull stripped image (dwi) for generating tensor in order to generate FA values. I am not using this as a mask (-mask option).

The reason I chose this approach, is because despite using the brain mask generated with dwi2mask and then using it as -mask brainMask.mif in dwi2tensor; it was generating high FA values for some regions which were not part of skull or bone.

So I sent my dwi image ‘dcorr_DTI_P2.mif’ (first converted into .nii using mrconvert) and obtained a skull stripped brain image using FSL as such,

 bet dcorr_DTI_P2.nii skullstrip_dcorr_DTI_P2.nii -f 0.2

Then, I reconverted this new dwi image into .mif format.

Prior to this I had already exported the gradient table as such.

 mrinfo dcorr_DTI_P2.mif -export_grad_mrtrix grad.b

I now re-use this gradient table with dwi2tensor as such,

 dwi2tensor skullstrip_dcorr_DTI_P2.mif dtensor_dCorrection.mif -grad grad.b

And it complains as follows,

 dwi2tensor: [ERROR] dwi image should contain 4 dimensions
 dwi2tensor: [ERROR] unable to get valid diffusion gradient table for image "skullstrip_dcorr_DTI_P2.mif"

I had not used the first approach as mentioned in your post; of using mrconvert and including -grad grad.b.

But I have now tried this approach and it still gives me the previous error mention

Hope this helps.

Kind regards

No problem using your own skull stripping procedure to generate a mask, plenty of people do that. I’m guessing the problem here is that bet is designed to work on single-volume anatomical images, and so when presented with a multi-volume input such as a DWI series, will only operate on and output the first volume. So your skullstrip_dcorr_DTI_P2.nii presumably only contains the first volume, leaving out the bulk of the actual DWI data. You’d be better off getting bet to output a binary mask (-m option if memory serves me right), and passing that to dwi2tensor (or wherever else you might need it) using the -mask option, using your original DWI data as input.

Alright thanks