# Converting Array of Points to Segmentation Node

**URL:** https://discourse.slicer.org/t/converting-array-of-points-to-segmentation-node/35037
**Category:** Development
**Tags:** segmentation
**Created:** [March 24, 2024, 2:58am UTC](https://discourse.slicer.org/t/converting-array-of-points-to-segmentation-node/35037 "2024-03-24T02:58:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![THartman](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@THartman](https://discourse.slicer.org/u/THartman)
#### Post date: [March 24, 2024, 2:58am UTC](https://discourse.slicer.org/t/converting-array-of-points-to-segmentation-node/35037/1 "2024-03-24T02:58:15Z")

</div>

Operating system: Windows  
Slicer version: 5.6.1  
Expected behavior: I am trying to programmatically create several segments within a file, to be passed into the Vascular Modelling Toolkit in order to extract the centerlines.  
Actual behavior: I currently can create arrays for each vessel containing the location of every voxel within that particular vessel, but have not figured out how to convert this to a segmentation.

I saw that I could use a labelMapNode to create a segmentation, but am having trouble finding the best way to do this. Any advice on this matter would be greatly appreciated.

---

<div class="post-metadata">

### Author: ![THartman](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@THartman](https://discourse.slicer.org/u/THartman)
#### Post date: [March 24, 2024, 3:21pm UTC](https://discourse.slicer.org/t/converting-array-of-points-to-segmentation-node/35037/2 "2024-03-24T15:21:13Z")

</div>

After a few hours of tinkering yesterday, I did manage to figure out how to achieve this. I ended up making an array matching the shape of the original volume, but making each vessel have a unique id (1-numOfVessels). After this, I created a new vtkMRMLLabelMapNode and used the method that updates the labelmap volume based on an array before porting that labelmap into a segmentation. Now I just need to figure out exactly how to pass these segmentations into VMTK and I should be looking good.
