# Extract CenterLine - Start in py

**URL:** <https://discourse.slicer.org/t/extract-centerline-start-in-py/26426>\
**Category:** Support\
**Tags:** python, centerlines\
**Created:** [November 24, 2022, 4:32pm UTC](https://discourse.slicer.org/t/extract-centerline-start-in-py/26426 "2022-11-24T16:32:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucas\_sd](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lucas_sd/32/17087_2.png) [@lucas\_sd](https://discourse.slicer.org/u/lucas_sd)\
**Post date:** [November 24, 2022, 4:32pm UTC](https://discourse.slicer.org/t/extract-centerline-start-in-py/26426/1 "2022-11-24T16:32:01Z")

</div>

Hi,

I have two points and a segmentation and I would like to obtain the center line. I did that using the extension VMTK and now I would like to do this in my phyton script, just like an other part of my process.

Can I use slicer.modules.extractcenterline.logic() for that? How? Can anybody share un example to guide me? I saw the extratcenterline.py but Im really lost.

Thanks, Lucas.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [November 24, 2022, 6:38pm UTC](https://discourse.slicer.org/t/extract-centerline-start-in-py/26426/2 "2022-11-24T18:38:57Z")

</div>

If your script runs inside Slicer, you can get the logic class this way :

```auto
import ExtractCenterline
extractCenterlineLogic = ExtractCenterline.ExtractCenterlineLogic()

```

It contains everything you need to work with your inputs.

---

<div class="post-metadata">

**Author:** ![lucas\_sd](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lucas_sd/32/17087_2.png) [@lucas\_sd](https://discourse.slicer.org/u/lucas_sd)\
**Post date:** [November 28, 2022, 5:42pm UTC](https://discourse.slicer.org/t/extract-centerline-start-in-py/26426/3 "2022-11-28T17:42:34Z")

</div>

Hi Chir, once again thanks for your help. I used the same logic to use the module CurvedPlanar and it worked very well.  
Thanks!
