# How to get brain mask from MR images using skull stripping?

**URL:** <https://discourse.slicer.org/t/how-to-get-brain-mask-from-mr-images-using-skull-stripping/2508>\
**Category:** Development\
**Created:** [April 3, 2018, 8:43pm UTC](https://discourse.slicer.org/t/how-to-get-brain-mask-from-mr-images-using-skull-stripping/2508 "2018-04-03T20:43:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yingli\_Lu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/yingli_lu/32/1398_2.png) [@Yingli\_Lu](https://discourse.slicer.org/u/Yingli_Lu)\
**Post date:** [April 3, 2018, 8:43pm UTC](https://discourse.slicer.org/t/how-to-get-brain-mask-from-mr-images-using-skull-stripping/2508/1 "2018-04-03T20:43:34Z")

</div>

Hi,  
OS: Windows 10  
slicer: 4.8.1

```
 I have a MR volume:

   dimensions: 120x256x256
   spacing: 1mm x 1mm x 1mm
   origin: 0mm 0mm 0mm
   IJK to RAS direction matrix: 
     0 0 1
     0 1 0
     1 0 0 

```

after apply skullStripper:

```
 got a brain mask(LabelMapVolumeNode):
    dimensions: 256x256x80
    spacing: 1mm x 1mm x 1.5mm
    origin: 256mm 256mm 0mm
    IJK to RAS direction matrix: 
            -1 0 0
            0 -1 0
            0 0 -1 

```

_Confusion_: Why the brain mask’s image properties are different with the original MR image?  
_Question_: Is there a quick/easy way to apply the brain mask on the original MR image in python script(mask out the MR image background)?

Any suggestions are greatly appreciated!

Thanks!

YingLi

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 3, 2018, 10:07pm UTC](https://discourse.slicer.org/t/how-to-get-brain-mask-from-mr-images-using-skull-stripping/2508/2 "2018-04-03T22:07:49Z")

</div>

Have you tried the SwissSkullStripper extension? That may give you the mask as you expect, with the warping transform already applied. If not, then use an image resample module to apply the computed transform to the skull mask.

---

<div class="post-metadata">

**Author:** ![Yingli\_Lu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/yingli_lu/32/1398_2.png) [@Yingli\_Lu](https://discourse.slicer.org/u/Yingli_Lu)\
**Post date:** [April 10, 2018, 1:23pm UTC](https://discourse.slicer.org/t/how-to-get-brain-mask-from-mr-images-using-skull-stripping/2508/3 "2018-04-10T13:23:13Z")

</div>

SwissSkullStripper gave the mask needed.

Thanks Andras!

---

<div class="post-metadata">

**Author:** ![ezproxy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ezproxy/32/2033_2.png) [@ezproxy](https://discourse.slicer.org/u/ezproxy)\
**Post date:** [August 12, 2018, 6:25pm UTC](https://discourse.slicer.org/t/how-to-get-brain-mask-from-mr-images-using-skull-stripping/2508/4 "2018-08-12T18:25:36Z")

</div>

Thank you, u are so kind for us.
