# Binary image to cloud points in physical coordinates

**URL:** <https://discourse.itk.org/t/binary-image-to-cloud-points-in-physical-coordinates/3781>\
**Category:** Algorithms\
**Created:** [January 19, 2021, 12:04pm UTC](https://discourse.itk.org/t/binary-image-to-cloud-points-in-physical-coordinates/3781 "2021-01-19T12:04:04Z")\
**Posts on this page:** 6\
**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, 12:04pm UTC](https://discourse.itk.org/t/binary-image-to-cloud-points-in-physical-coordinates/3781/1 "2021-01-19T12:04:04Z")

</div>

I have a binary 3d image. How can I extract a point cloud from the image surface in physical coordinates?

---

<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:** [January 19, 2021, 3:00pm UTC](https://discourse.itk.org/t/binary-image-to-cloud-points-in-physical-coordinates/3781/2 "2021-01-19T15:00:04Z")

</div>

This [example](https://itk.org/ITKExamples/src/Core/Mesh/ExtractIsoSurface/Documentation.html) should help.

---

<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, 3:18pm UTC](https://discourse.itk.org/t/binary-image-to-cloud-points-in-physical-coordinates/3781/3 "2021-01-19T15:18:55Z")

</div>

Hi, thanks for your answer but this example uses itk :: BinaryMask3DMeshSource. In my previous question [Previous question](https://discourse.itk.org/t/how-to-obtain-the-physical-coordinates-of-the-nodes-in-an-itk-mesh-obtained-from-a-3d-volume-of-ct-images/3773) I asked how to get the physical coordinates of the mesh. As you told me according to the comments and the code seems to be that the coordinates of the mesh are physical coordinates but when I assign the GetOutput () method of itk :: BinaryMask3DMeshSource object to an ITK :: Mesh and I access the nodes and the cells coordinates, both are still in CT image coordinates and not physical coordinates. Maybe I’m doing something wrong but I don’t know.

---

<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:** [January 19, 2021, 3:25pm UTC](https://discourse.itk.org/t/binary-image-to-cloud-points-in-physical-coordinates/3781/4 "2021-01-19T15:25:43Z")

</div>

When reading your CT image, are you getting all its metadata too? Physical coordinates are computed from the metadata.

---

<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, 3:52pm UTC](https://discourse.itk.org/t/binary-image-to-cloud-points-in-physical-coordinates/3781/5 "2021-01-19T15:52:54Z")

</div>

I am reading an nrrd file, this file is a volume formed from several slices. I am reading the file the same as in this example [Example](https://itk.org/ITKExamples/src/Core/Mesh/ExtractIsoSurface/Documentation.html)

---

<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:** [January 19, 2021, 4:12pm UTC](https://discourse.itk.org/t/binary-image-to-cloud-points-in-physical-coordinates/3781/6 "2021-01-19T16:12:09Z")

</div>

You could try a better image to mesh converter, in [Cuberille](https://github.com/InsightSoftwareConsortium/ITKCuberille) module. It can be built as part of ITK by enabling `Module_Cuberille` in CMake configuration.
