Dimension mismatch fa.mif and roi.mif when extracting FA values of a ROI

Dear MRtrix experts,

I’m trying to extract mean FA and MD values from a single ROI. I have tried the following approach for FA values, and I was planning on using a similar command for MD values:

mrstats fa.mif -mask roi.mif -output mean > roi_fa.txt

This is followed by an error saying that there is a dimension mismatch between fa.mif and roi.mif. I obtained my fa.mif file by the following commands:

dwi2tensor dwi_preproc.mif tensor.mif
tensor2metric tensor.mif -fa fa.mif

The ROI was made on a T1 DW coregistered image and then saved.
Does anybody have any suggestions for what went wrong?

Excuse me if my question tends to be a bit basic, I’m still pretty new to MRtrix. Thanks a lot in advance!


For context, mrview creates the ROI based on the main image loaded upon which the ROI is drawn and mrstats operates on the voxel-level. So if your T1 and DW images do not share the same voxel grid (number of voxels but also real-space locations), you’d need to modify the ROI. One way to do so is to regrid the ROI onto the DWI grid and you’d probably interpolate using nearest-neighbour or linear interpolation:
You can do so with the new (as of 3.0) command mrgrid
mrgrid roi_t1grid.mif regrid -template fa.mif roi_dwigrid.mif -interp nearest
or with
mrtransform roi_t1grid.mif -template fa.mif roi_dwigrid.mif -interp nearest


Thank you for your suggestion @maxpietsch! I was wondering, would drawing a ROI on a prepossessed DWI image instead of the co-registered image be a possible, more convienent alternative? I have tried that and the dimension mismatch error did not occur anymore…


Sure, unless of course you want the T1 contrast (or resolution) to guide your ROI drawing.

Perfect! Thanks a lot for your help!