# Script to compute Voronoi diagrams/largest aorta diameter using VMTK

**URL:** <https://discourse.slicer.org/t/script-to-compute-voronoi-diagrams-largest-aorta-diameter-using-vmtk/17549>\
**Category:** VMTK\
**Created:** [May 10, 2021, 7:04pm UTC](https://discourse.slicer.org/t/script-to-compute-voronoi-diagrams-largest-aorta-diameter-using-vmtk/17549 "2021-05-10T19:04:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 11, 2021, 3:37am UTC](https://discourse.slicer.org/t/script-to-compute-voronoi-diagrams-largest-aorta-diameter-using-vmtk/17549/2 "2021-05-11T03:37:02Z")

</div>

To use VTK from a script in Slicer’s Python environment:

> [@banderies](#):
>
> 1. Load the nifti mask as a volume (seemingly can’t be loaded as a segmentation without loading a corresponding volume as well)
> 2. Apply a simple threshold to get a segmentation (mask will be 0 or 1)

Instead of these steps, you can load the nifti mask directly as a segmentation node. See [example](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#load-a-3d-image-or-model-file-as-segmentation).

If you want to run some additional Segment Editor effects, you can load the mask as a scalar volume and use it as master volume and then follow [these examples](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#use-segment-editor-effects-from-script-qmrmlsegmenteditorwidget).

> [@banderies](#):
>
> - Simplify mesh/create model appropriate for VMTK processing
> - Compute Voronoi diagram and centerlines
> - Extract data as table(?) and/or save the largest diameter

You can use [Extract Centerline](https://github.com/vmtk/SlicerExtension-VMTK/blob/master/ExtractCenterline/ExtractCenterline.py) module logic class from your own scripts or copy paste any parts of the modules into your scripts.

If the aneurysms are not just slightly dilated vessels but ballooning out then instead of centerline analysis you may consider segmenting the aneurysm sack and get shape properties using Segment Statistics module (there are [many optional shape metrics](https://discourse.slicer.org/t/new-segment-statistics-oriented-bounding-box-diameter-and-more/10203) that you can enable).

---

_[View the full topic](https://discourse.slicer.org/t/script-to-compute-voronoi-diagrams-largest-aorta-diameter-using-vmtk/17549)._
