# Editing endpoints in extract centerline module by Python scripting

**URL:** <https://discourse.slicer.org/t/editing-endpoints-in-extract-centerline-module-by-python-scripting/12250>\
**Category:** Development\
**Tags:** centerlines\
**Created:** [June 28, 2020, 5:19am UTC](https://discourse.slicer.org/t/editing-endpoints-in-extract-centerline-module-by-python-scripting/12250 "2020-06-28T05:19:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 28, 2020, 5:19am UTC](https://discourse.slicer.org/t/editing-endpoints-in-extract-centerline-module-by-python-scripting/12250/1 "2020-06-28T05:19:57Z")

</div>

Hello Everyone,  
Currently, the extract centerline module allows the removal of branches by clicking on the endpoints.  
I would like to know if it’s possible to do the same task using a set of input coordinates (coordinates of  
endpoints/free ends or junction points) specified by the user.

---

<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 28, 2020, 1:13pm UTC](https://discourse.slicer.org/t/editing-endpoints-in-extract-centerline-module-by-python-scripting/12250/2 "2020-06-28T13:13:59Z")

</div>

Yes, you can get index of a control point based on its position and remove it by calling methods of the markups node.

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 28, 2020, 2:05pm UTC](https://discourse.slicer.org/t/editing-endpoints-in-extract-centerline-module-by-python-scripting/12250/3 "2020-06-28T14:05:09Z")

</div>

I have the indices of the position using `GetPointId`.

> [@lassoan](#):
>
> remove it by calling methods of the markups node.

I am not sure how to do this. May I know if examples are available to understand how this can be done?

---

<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 28, 2020, 2:22pm UTC](https://discourse.slicer.org/t/editing-endpoints-in-extract-centerline-module-by-python-scripting/12250/4 "2020-06-28T14:22:08Z")

</div>

These should be all fairly straightforward and it is hard to guess where you might have stuck. Please share the script that you are trying to use and indicate where it does not work as expected.
