# White Matter Mask Generation

**URL:** <https://community.mrtrix.org/t/white-matter-mask-generation/1181>\
**Category:** Uncategorized\
**Created:** [September 21, 2017, 5:53pm UTC](https://community.mrtrix.org/t/white-matter-mask-generation/1181 "2017-09-21T17:53:58Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![SuperClear](https://community.mrtrix.org/user_avatar/community.mrtrix.org/superclear/32/2222_2.png) [@SuperClear](https://community.mrtrix.org/u/SuperClear)\
**Post date:** [October 6, 2017, 3:43pm UTC](https://community.mrtrix.org/t/white-matter-mask-generation/1181/3 "2017-10-06T15:43:48Z")

</div>

Hi, Donald,

The problem is that: `[ERROR] input images do not have the same number of dimensions`.

t1\_mpr\_ns\_sag\_iso\_5TT\_nocrop\_WM\_axis3\_wrped.nii.gz **(176x224x256)**  
DTI\_30\_average-6.nii **(128 x 128 x 44 x 186)**

I wonder if there is a method to resample the 3rd volume of 5TT image to 128x128x44, so that I can use it as a white matter mask?

* * *

The information of both scans is shown below in the images:

![image](https://community.mrtrix.org/uploads/default/original/1X/86defdefe65c157086ad54522d6fd5d5c28efc2f.png)

![image](https://community.mrtrix.org/uploads/default/original/1X/e23ced6c97eead043796667e0a95890ca61d7e58.png)

Here are my current commands:

1. 5ttgen fsl t1\_mpr\_ns\_sag\_iso.nii.gz t1\_mpr\_ns\_sag\_iso\_5TT\_nocrop.mif -nocrop

2. extract the 3rd volume (WM volume):  
mrconvert -coord 3 2 t1\_mpr\_ns\_sag\_iso\_5TT\_nocrop.mif t1\_mpr\_ns\_sag\_iso\_5TT\_nocrop\_WM.nii.gz

3. reduce 4D image to 3D image:  
mrmath t1\_mpr\_ns\_sag\_iso\_5TT\_nocrop\_WM.nii.gz mean -axis 3  
t1\_mpr\_ns\_sag\_iso\_5TT\_nocrop\_WM\_axis3.nii.gz

4. [Register t1\_mpr\_ns\_sag\_iso\_5TT\_nocrop\_WM\_axis3.nii.gz to DTI\_30\_average-6.mif](https://community.mrtrix.org/t/registration-of-structural-and-diffusion-weighted-data/203/8?u=superclear)

Thanks,  
Chaoqing

---

_[View the full topic](https://community.mrtrix.org/t/white-matter-mask-generation/1181)._
