# Closest point of a plane to a 3d image in physical coordinates.

**URL:** <https://discourse.itk.org/t/closest-point-of-a-plane-to-a-3d-image-in-physical-coordinates/3779>\
**Category:** Algorithms\
**Created:** [January 19, 2021, 5:34am UTC](https://discourse.itk.org/t/closest-point-of-a-plane-to-a-3d-image-in-physical-coordinates/3779 "2021-01-19T05:34:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ainor](https://discourse.itk.org/user_avatar/discourse.itk.org/ainor/32/2087_2.png) [@ainor](https://discourse.itk.org/u/ainor)\
**Post date:** [January 19, 2021, 5:34am UTC](https://discourse.itk.org/t/closest-point-of-a-plane-to-a-3d-image-in-physical-coordinates/3779/1 "2021-01-19T05:34:01Z")

</div>

I have a 3d image formed from a volume of slices. Each Slices in the volume is a binary image (the region of interest has pixels with a value of 255 and the rest of the image is zero).  
I have a plane in the physical coordinates of the volume. How can I find the point of the region of interest that is closest to the plane in physical coordinates.  
I know how to find the closest point to a plane using math, but I don’t know how to do it using ITK, can someone give me an idea of an efficient way to do this.

---

<div class="post-metadata">

**Author:** ![dchen](https://discourse.itk.org/user_avatar/discourse.itk.org/dchen/32/34_2.png) [@dchen](https://discourse.itk.org/u/dchen)\
**Post date:** [January 19, 2021, 5:58am UTC](https://discourse.itk.org/t/closest-point-of-a-plane-to-a-3d-image-in-physical-coordinates/3779/2 "2021-01-19T05:58:17Z")

</div>

Make a distance field image of the plane. Then use the binary image as a mask on that distance field. And then find the minimum value of that masked distance field.

---

<div class="post-metadata">

**Author:** ![ainor](https://discourse.itk.org/user_avatar/discourse.itk.org/ainor/32/2087_2.png) [@ainor](https://discourse.itk.org/u/ainor)\
**Post date:** [January 19, 2021, 6:08am UTC](https://discourse.itk.org/t/closest-point-of-a-plane-to-a-3d-image-in-physical-coordinates/3779/3 "2021-01-19T06:08:08Z")

</div>

Excuse me but I am new to working with ITK, could you explain this topic better ( **Make a distance field image of the plane. Then use the binary image as a mask on that distance field**.).

---

<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:** [January 19, 2021, 2:41pm UTC](https://discourse.itk.org/t/closest-point-of-a-plane-to-a-3d-image-in-physical-coordinates/3779/4 "2021-01-19T14:41:15Z")

</div>

Hello @ainor,

Please look at this [related question](https://discourse.itk.org/t/create-mask-for-3d-image-based-on-plane/2347/3) which I believe also addresses your need.
