Dimension mismatch between 5tt.mif and dwi.mif

Hi, everyone.

Except the resampling, is there a better way to keep the dimension of 5tt.mif as the input t1 image after running 5ttgen. Here is the error message. mrcalc wm_pve.mif 0.95 -ge fa.mif 0.75 -ge -mult wm_sf.mif mrcalc: ERROR dimensions of input images do not match - aborting

In my case, the 5tt.mif was created via [code] 5ttgen fsl lin_t12b0.mif 5tt.mif

  1. mrinfo dwi.mif Dimensions: 224 x 224 x 70 x 33
  2. mrinfo b0.mif Dimensions: 224 x 224 x 70 x 1
  3. mrinfo lin_t12b0.mif Dimensions: 224 x 224 x 70
  4. mrinfo 5tt.mif Dimensions: 171 x 216 x 70 x 5

According to the decription of Global tractography, the 5tt,mif was generated by a script, known as act_anat_prepare_fsl. But I did not find it in recent Mrtrix 3 in GiuHub. Any news on this script?

Hi Meng,

The act_anat_prepare_fsl script has been replaced by 5ttgen, so you’re using the correct one already. You can now use dwi2response msmt_5tt dwi.mif 5tt.mif gm.txt wm.txt csf.txt to compute all tissue response functions directly. I’ll update the docs accordingly.

To answer your main question, even with the new script you would have to register or at least resample the T1 to the DWI data, I think. If both are already in the same reference frame, this is a straightforward step, which you can do easily with mrtransform. If not, you need to co-register them with a registration tool of your choice (ANTs, FSL, ITK, …, and MRtrix3 in the near future).


The new 5ttgen script has the -nocrop option, which will mean that the output 5tt image will have the same dimensions as the input t1 image.

For most, the FA image will typically be defined on the same grid as the DWI, which won’t match your t1, and therefore an explicit mrtransform call will be required somewhere. But it looks like in your case you have regridded the DWI to t1 space at a prior step?

I had applied with the nocrop already.

  • input t1: mrinfo lin_t12b0.mif Dimensions: 224 x 224 x 70
  • cropped: mrinfo 5tt.mif Dimensions: 148 x 189 x 69 x 5
  • no_crop: mrinfo 5tt.mif Dimensions: 171 x 216 x 70 x 5

Is seems the output dimension is quite arbitrary. I guess it relate with the input T1 with skull-stripped or not.

In my case, I registered the original T1 to B0 with flirt for testing, which should be improved later.

Ah yes, of course: In most cases, standard_space_roi is used to crop the FoV in order to get bet to behave better. So although the -nocrop option bypasses the explicit mrcrop step, the FoV is still reduced with respect to the original T1.

Does anybody have any experience as to whether the -roiFOV option for standard_space_roi is required for bet, or whether the masking step is adequate enough?

OK, hopefully this should be fixed now.

What I’ve done is: If you specify -nocrop to 5ttgen, then the standard_space_roi step will not crop the image FoV based on the standard space template. Therefore, the dimensions of the final image output by the script should match the input image, without any intervention required by the user. In my testing this wasn’t detrimental to the bet step, but I can’t test every possible case, so we’ll just have to wait and see (hopefully the -R option for bet will help in this regard).


@rsmith, thank your for your great work.