# Registering a pair of binary masks

**URL:** https://discourse.itk.org/t/registering-a-pair-of-binary-masks/5098
**Category:** Beginner Questions
**Tags:** registration, python, simpleitk
**Created:** [June 17, 2022, 1:48am UTC](https://discourse.itk.org/t/registering-a-pair-of-binary-masks/5098 "2022-06-17T01:48:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![goofyduck](https://discourse.itk.org/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@goofyduck](https://discourse.itk.org/u/goofyduck)
#### Post date: [June 17, 2022, 1:48am UTC](https://discourse.itk.org/t/registering-a-pair-of-binary-masks/5098/1 "2022-06-17T01:48:15Z")

</div>

I’m trying to register a pair of binary masks, not a pair of images. To explain further, I’m trying to build a model that automatically strips the brain from the head skull. For the better model accuracy, I already have labeled the brain area using ITK-SNAP. I just wonder if I can do the registration between the binary masks, not the images. Is there any tool for this purpose?

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [June 17, 2022, 12:58pm UTC](https://discourse.itk.org/t/registering-a-pair-of-binary-masks/5098/2 "2022-06-17T12:58:05Z")

</div>

Hello @goofyduck,

Registration of binary objects is harder than registering the original images, so recommend to either register the original images or distance maps of the binary segmentations, along the lines of:

```auto
distance_map1 = sitk.SignedMaurerDistanceMap(binary_image1, squaredDistance=False, useImageSpacing=True)
distance_map2 = sitk.SignedMaurerDistanceMap(binary_image2, squaredDistance=False, useImageSpacing=True)
tx = register(distance_map1, distance_map2)

```

If you do not want to write code, possibly look into using [Slicer’s registration](https://slicer.readthedocs.io/en/latest/user_guide/registration.html).
