# Using VMTK Branch Extractor Programatically (Python)

**URL:** <https://discourse.slicer.org/t/using-vmtk-branch-extractor-programatically-python/16560>\
**Category:** VMTK\
**Created:** [March 16, 2021, 3:16am UTC](https://discourse.slicer.org/t/using-vmtk-branch-extractor-programatically-python/16560 "2021-03-16T03:16:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjg](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@mjg](https://discourse.slicer.org/u/mjg)\
**Post date:** [March 16, 2021, 3:16am UTC](https://discourse.slicer.org/t/using-vmtk-branch-extractor-programatically-python/16560/1 "2021-03-16T03:16:46Z")

</div>

How can I get a bifurcated centerline as two separate numpy arrays? I can view the two centerlines with the below code. How can I then get the red centerline as one numpy array, and the blue centerline as another numpy array?

Thank you!

```
vmtkCommand = r'vmtkcenterlines -ifile ' + modelPath + r' --pipe vmtkbranchextractor -ofile ' + extractedPath + r' --pipe vmtkcenterlineviewer -cellarray CenterlineIds'
myPype = pypes.PypeRun(vmtkCommand)

```

Which returns:

 ![Screen Shot 2021-03-15 at 11.10.37 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/1/71560e04df688776ec3814e33b5fb1306d2e5c08.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:** [March 26, 2021, 3:34am UTC](https://discourse.slicer.org/t/using-vmtk-branch-extractor-programatically-python/16560/2 "2021-03-26T03:34:01Z")

</div>

You can see an example of how to extract a specific branch by thresholding based on group ID:

> <https://github.com/vmtk/SlicerExtension-VMTK/blob/3787ea4a300da28ec5f0824f0715f2713b631155/ExtractCenterline/ExtractCenterline.py#L938-L946>
