# Extracting the centerline of a tunnel point cloud 

**URL:** <https://discourse.slicer.org/t/extracting-the-centerline-of-a-tunnel-point-cloud/19889>\
**Category:** Support\
**Created:** [September 27, 2021, 8:33pm UTC](https://discourse.slicer.org/t/extracting-the-centerline-of-a-tunnel-point-cloud/19889 "2021-09-27T20:33:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmad1](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@Ahmad1](https://discourse.slicer.org/u/Ahmad1)\
**Post date:** [September 27, 2021, 8:33pm UTC](https://discourse.slicer.org/t/extracting-the-centerline-of-a-tunnel-point-cloud/19889/1 "2021-09-27T20:33:27Z")

</div>

Hello, I am a new user of 3d slicer. Currently I am working on extracting the centerline of a tunnel. I have the tunnel as point cloud data and I have managed to use Pyvista to create the mesh. My question is can I load the point cloud data directly to 3d slicer and compute the centerline or should I do some modification?  
Any tips or procedures to convert my data into the specified formats are appreciated.  
Thank you.

---

<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:** [September 27, 2021, 8:39pm UTC](https://discourse.slicer.org/t/extracting-the-centerline-of-a-tunnel-point-cloud/19889/2 "2021-09-27T20:39:49Z")

</div>

You can get a centerline curve from a model or segmentation using [VMTK extension’s](https://github.com/vmtk/SlicerExtension-VMTK/#the-vmtk-extension-for-3d-slicer) Extract centerline module.

By “point cloud” do you mean you have a labelmap volume where certain points are labeled as tunnel points; or you have a list of points in a vtkPolyData in completely random positions? If it is the former then you don’t need any processing using pyvista but you can load the volume directly into Slicer.

---

<div class="post-metadata">

**Author:** ![Ahmad1](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@Ahmad1](https://discourse.slicer.org/u/Ahmad1)\
**Post date:** [September 27, 2021, 9:49pm UTC](https://discourse.slicer.org/t/extracting-the-centerline-of-a-tunnel-point-cloud/19889/3 "2021-09-27T21:49:26Z")

</div>

Hello, thanks for the reply. The data I have are raw 3d data collected by a terrestrial laser scanner, thus each point is defined by an x,y,z coordinate.  
If you mean by lablemap volume a voxel grid, I think I can transform the point cloud into a voxel grid in Open3d, but I dont know if there should be further modifications since the tunnel is open on entry and exit and has some branches on the sides. Plus does it need to be a solid object and not hollow on the inside?  
Again much appreciated for the help.

---

<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:** [September 28, 2021, 12:09am UTC](https://discourse.slicer.org/t/extracting-the-centerline-of-a-tunnel-point-cloud/19889/4 "2021-09-28T00:09:14Z")

</div>

If you use a laser scanner then probably reconstructing a surface is better representation than a labelmap volume.

If you often load such scans and you want to make it very convenient for users then you can add a module with a GUI that performs the surface reconstruction, centerline extraction, and any further analysis or processing that you may need.

---

<div class="post-metadata">

**Author:** ![Ahmad1](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@Ahmad1](https://discourse.slicer.org/u/Ahmad1)\
**Post date:** [September 28, 2021, 7:13am UTC](https://discourse.slicer.org/t/extracting-the-centerline-of-a-tunnel-point-cloud/19889/5 "2021-09-28T07:13:57Z")

</div>

I will try to construct the surface and see what I can obtain. Again thank you for your fast support and accurate descriptions. Much appreciated.
