# Signed distance map generation

**URL:** <https://discourse.itk.org/t/signed-distance-map-generation/1264>\
**Category:** Algorithms\
**Created:** [September 8, 2018, 10:14am UTC](https://discourse.itk.org/t/signed-distance-map-generation/1264 "2018-09-08T10:14:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TearsOfMyLoves\_Lee](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/b5a626/32.png) [@TearsOfMyLoves\_Lee](https://discourse.itk.org/u/TearsOfMyLoves_Lee)\
**Post date:** [September 8, 2018, 10:14am UTC](https://discourse.itk.org/t/signed-distance-map-generation/1264/1 "2018-09-08T10:14:36Z")

</div>

Hi, I am new to ITK. I have used ITK ApproximateSignedDistanceMapImageFilter example to generate the signed distance map for an input binary image, where pixels inside of the object have negative distance while pixels outside of the object have positive distance. Instead of viewing the signed distance map, how could I modify the algorithm so that I can save the output as an image? Thank you.

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [September 8, 2018, 2:39pm UTC](https://discourse.itk.org/t/signed-distance-map-generation/1264/2 "2018-09-08T14:39:48Z")

</div>

You need to write the image returned by `approximateSignedDistanceMapImageFilter->GetOutput()`. Here is an [example](https://itk.org/ITKExamples/src/IO/ImageBase/WriteAnImage/Documentation.html) which shows how to write an image.
