Fine-tuning a mask in dwi2mask?

I was curious of the mask that dwi2mask creates internally when dwifslpreproc is running, so I went and run dwi2mask on its own. For this dataset, this is what it created:

So the mask is bigger than the brain in certain areas and smaller in others (e.g. cerebellum), apparently because of how the first b0 looks. Is there a way to manipulate the “sensitivity” of algorithm with a command similar to bet -f?

Another option I tried was extracting the first DWI volume (which is much cleaner than the b0):


However dwi2mask requires a 4D file to work.

Any suggestions to create a mask that better captures the brain to be analysed?

Thanks!

Hi Sepastian,

The current dwi2mask implementation uses a combination of DWI data across all b-values, including b=0; but because the resulting mask is an intersection of masks across b-values, if the mask estimated from the b=0 data (based on an optimal threshold derived from & applied to the mean b=0 image) extends too far, then the final output mask will extend too far. This particular algorithm further does not have any “free parameters” that would be capable of “tuning” the behaviour in this instance.

You would likely be better-served making use of the dwifslpreproc -eddy_mask option, which will bypass the internal dwi2mask call by using the image you provide instead. It might not be perfect because ideally the mask utilised by eddy should contain brain voxels in the undistorted image, so if an image possessing susceptibility distortions is used to produce that mask it may not be quite right; but eddy is also not super sensitive to the mask, so if the distortions aren’t absurdly large it should be OK.

I’ll also note that in 3.1.0 not only will there be multiple dwi2mask algorithms to choose from (since it’s a persistent cause of grief, but different approaches work better or worse for different data), it will be possible to specify one’s preferred algorithm in the config file, and that’s the algorithm that will be used whenever an MRtrix3 Python script needs to invoke dwi2mask internally. You can see a preview of those coming features here.

Cheers
Rob

1 Like

Thanks for your reply, Rob =) I’ll see how I go in the meantime. Maybe I’ll have to use bet with other types of scans with less distortions. Anyway, food for thought. Have a nice day!

This sounds so exciting! When will we get this new version!