Where is the code for computation of centerline?

Hi,

I am trying to use VMTK to compute the centerline of a hollowed cylinder with Python. But I can’t find the code responsible of computing the centerline.
Could someone guide me to this certain code?

I would appreciate any help!

Thanks,

Bastien

These C++ classes are used from this Python script to get the vessel centerline. Probably the easiest is to get started with the VMTK GUI in 3D Slicer. If you find the code hard to interpret, then you can run the Extract Centerline module step by step using a Python debugger. You can find detailed description of all algorithmic details of VMTK in Luca Antiga’s PhD thesis.

1 Like

Thanks a lot for the scripts @lassoan !

Is it possible to use the centerline extraction without slicer?
In my case I created the mesh of my cylinder on vtk and I want to extract the centerline of it without using slicer. I found this python code this morning, do you think it is worth exploring this script or not ?

Yes, sure you can extract the centerline using VMTK classes in any environment, in any programming language.

The script that I linked implements a complete solution. It lets the user select input mesh or segmentation, performs all necessary preprocessing (to make sure that the computation is fast and robust), automatically detects vessel endpoints, allows the user adjust the endpoints (add/delete/move, specify inflow/outflow direction), computes the centerline and basic metrics, and displays results. All the GUI related features require 3D Slicer, but if you have your own GUI then you can rewrite those parts.

vmtkScripts/vmtkcenterlines.py is good, but it contains only the computation of the centerline, so you need to add a lot of things to get a complete solution. You can find other very useful code snippets for that in the same folder, but they still don’t contain everything (such as robust preprocessing and automatic centerline endpoints computation); and interactive GUI examples are extremely limited.

Thank you for taking the time to answer my questions. It is much clearer for me!