# How does vmtksurfacecenterlineprojection work

**URL:** <https://discourse.slicer.org/t/how-does-vmtksurfacecenterlineprojection-work/14513>\
**Category:** VMTK\
**Created:** [November 10, 2020, 12:02am UTC](https://discourse.slicer.org/t/how-does-vmtksurfacecenterlineprojection-work/14513 "2020-11-10T00:02:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nadun\_19](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nadun_19/32/8665_2.png) [@Nadun\_19](https://discourse.slicer.org/u/Nadun_19)\
**Post date:** [November 10, 2020, 12:02am UTC](https://discourse.slicer.org/t/how-does-vmtksurfacecenterlineprojection-work/14513/1 "2020-11-10T00:02:31Z")

</div>

Hi

I was wondering how the vmtksurfacecenterlineprojection function actually carries out the centerline projection to a surface.

Thanks  
Nadun

---

<div class="post-metadata">

**Author:** ![lantiga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lantiga/32/8424_2.png) [@lantiga](https://discourse.slicer.org/u/lantiga)\
**Post date:** [November 13, 2020, 12:28am UTC](https://discourse.slicer.org/t/how-does-vmtksurfacecenterlineprojection-work/14513/2 "2020-11-13T00:28:52Z")

</div>

Hi @Nadun_19,  
for each point on the surface, the “closest” location on the centerline is computed and its attributes are set as the attributes of the surface point. Note that the centerline location is typically found in-between centerline points (i.e. looking along each segment), so the attributes might be interpolated accordingly.

The way “closest” is determined is done in two ways:

- by just using Euclidean distance (`-useradius 0`)
- by determining the location on the surface that is the center of the sphere of radius R whose surface is closest to the surface point (`-useradius 1`). In other words, thinking about the continuous envelope of spheres along the centerline (the so-called “canal surface”, or “tube”), for each surface point we determine the closest point on the canal surface, and from there the location on the centerline that is a center of the sphere that is tangent to the canal surface in that point.

Hope this helps

Luca
