# Convert from cartesian to polar coordinates using ExtractCenterline

**URL:** <https://discourse.slicer.org/t/convert-from-cartesian-to-polar-coordinates-using-extractcenterline/29831>\
**Category:** Support\
**Tags:** vmtk, vmtk-centerline\
**Created:** [June 4, 2023, 9:57pm UTC](https://discourse.slicer.org/t/convert-from-cartesian-to-polar-coordinates-using-extractcenterline/29831 "2023-06-04T21:57:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gening\_Dong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gening_dong/32/14706_2.png) [@Gening\_Dong](https://discourse.slicer.org/u/Gening_Dong)\
**Post date:** [June 4, 2023, 9:57pm UTC](https://discourse.slicer.org/t/convert-from-cartesian-to-polar-coordinates-using-extractcenterline/29831/1 "2023-06-04T21:57:46Z")

</div>

Hi all,

I’m trying to convert from Cartesian coordinates to polar coordinates for a heart lumen surface model. I used the module `Extract Centerline` to generate a centerline and `Cross-section analysis` to get some diameter data. However, I’m a bit confused from there.

1. This table only contains ~2000 rows but the surface model should have 5002 points and the centerline curve has only 238 points. Where came those ~2000 points shown in the table and what is the column `Distance` mean?
2. Are the values under the column `Diameter` the diameters of maximal inscribed spheres for each point on the centerline?
3. Let’s say I’d like to save the mesh nodes on the surface model and convert their coordinates from Cartesian (Is this same as RAS btw?) to polar. Am I able to do this using the vmtk extension? If not, it would be greatly appreciated if anyone can suggest another method.

Thanks much,  
Gening

 ![2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/2/222a2aadc9122180f81ad7029f3b2b2587069c94.jpeg)  
 ![3](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/7/27aa4932e7a5829f971bd2c3ba804dd7b460b414.png)

---

<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:** [June 5, 2023, 4:14am UTC](https://discourse.slicer.org/t/convert-from-cartesian-to-polar-coordinates-using-extractcenterline/29831/2 "2023-06-05T04:14:32Z")

</div>

> [@Gening\_Dong](#):
>
> This table only contains ~2000 rows but the surface model should have 5002 points and the centerline curve has only 238 points. Where came those ~2000 points shown in the table and what is the column `Distance` mean?

The centerline curve is resampled at equal distances. Distance is distance from the curve starting point in millimeters.

> [@Gening\_Dong](#):
>
> Are the values under the column `Diameter` the diameters of maximal inscribed spheres for each point on the centerline?

Yes.

> [@Gening\_Dong](#):
>
> Let’s say I’d like to save the mesh nodes on the surface model and convert their coordinates from Cartesian (Is this same as RAS btw?) to polar. Am I able to do this using the vmtk extension? If not, it would be greatly appreciated if anyone can suggest another method.

Yes, RAS coordinate system is Cartesian. VMTK can compute a consistent curve coordinate using parallel transport method (with normal vectors that are consistent along the curve, with minimal torsion). We implemented an improved version of the this coordianate system computation in Slicer, which allows setting the direction of the initial normal vector.

See [Slicer’s MarkupsCurveCoordinateFrameTest](https://github.com/Slicer/Slicer/blob/main/Modules/Loadable/Markups/Testing/Python/MarkupsCurveCoordinateFrameTest.py) for a full, detailed example. This is an example of the parallel transport based curve coordinate system:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/b/cb05f28c3ad9f97f740ac32ea901edf145d6f10b.png)
