Vessel tree centerline branch extraction using VMTK

In order to utilize some of vmtk functionalities (branch splitting is the one of interest, i.e. vmtkbranchextractor), is it possible to import their libraries?
However, a simple “import vmtk” does not seem to succeed, any pointers?

Thank you!

You need to import specific VMTK packages as it is done in existing VMTK modules in Slicer:

I see, thank you.
Correct, “import vtkvmtkSegmentationPython” is possible, but “import vmtkbranchextractor” or "“import vtkvmtkbranchextractor” is not possible, what am I missing?

Thanks again!

You need to follow the exact same format (note the capitalization and “Python” at the end). Probably you need something like this:

import vtkvmtkComputationalGeometryPython as vtkvmtkComputationalGeometry
extractor = vtkvmtkComputationalGeometry.vtkvmtkCenterlineBranchExtractor()
1 Like

If you manage to implement some new features it would be great if you could contribute back to SlicerVMTK extension (add to one of the existing modules or add a new module). We can help polishing things and adding to the extension.

FYI, I’ve added a simple function to VMTK Slicer extension to allow showing the extracted centerlines as a hierarchy of markups curves (it uses centerline branch extractor and merger):

This allows you to remove branches, assign names, show/hide sections, measure lengths, get parent/children branches easily.


Great, thank you for extending the extension! Some follow-up questions:

  1. What’s the reason this function cannot be used on the stable version 4.10?
  2. I modified 411 to 410 in the code, and tried it on 4.10.2, while “Curve tree root” is stuck at “None”, as clicking “Create New Node” or “Delete current node” does not lead anywhere.
  3. It will be great if you could create a quick tutorial video to explain how to use this function.

@szhang The function can’t be used in Slicer 4.10 because the actual curve object being used (vtkMRMLMarkupsCurveNode) is only available in Slicer 4.11. It is parts of the Markups module which had a major overhaul after Slicer 4.10 was released.


I’ve uploaded a short video that shows how to segment and extract centerline of vessels:


Excellent, thank you very much! The decimation is a good step to learn.
The tree branches look slightly off from the centerlines if I am not mistaken.

Preview puts result of network extraction (vtkvmtkPolyDataNetworkExtraction) into the output model node.

Full computation puts result of network+centerline extraction (vtkvmtkPolyDataNetworkExtraction+vtkvmtkPolyDataCenterlines) into the output model node, and result of additional branch extraction + merging is saved into curve nodes.

These are somewhat arbitrary. If you have better suggestions about what outputs to save then let me know. For example, we could save the result of branch extraction and merge into the output model node instead (or in addition).

Hello, a quick question here, do you suggest any work-around of the nightly built latest&greatest Markups module? i.e. if I still want to stick with the stable version 4.10.2?

Thank you!!

What is your motivation for continuing to stick with Slicer 4.10.2? Is there something in the Slicer nightly that doesn’t work/work well for you that is working in Slicer 4.10.2?

1 Like

Well, since not all modules are available to download from extension manager in the nightly version, and by simple copy-paste of the extension folder it doesn’t get the modules running (apparently). If the markup module was overhauled before python 3 migration and ITK upgrades to 5, is there such a nightly build to download?
To be back to the question of work-around in 4.10, if centerlines were already displayed, then branching is like highlighting portion of the lines, right?

Thank you!

Which modules you have trouble finding?

There is no difference in this between Slicer-4.10 and Slicer-4.11.

I don’t understand the question and cannot afford to spend time with thinking about workarounds for Slicer-4.10. However, I can help to make sure that you can do everything with latest Preview Release that you could do with Slicer-4.10.

The module AirwaySegmentationCLI cannot be found in the Preview Release.

Really appreciate your help!

@pieper has fixed it this week. Download today’s Slicer Preview Release - the Chest Imaging Platform extension is already available for it.

Hi there!

I have just installed the VMTK extension but I could not find the “Centerline Computation”. Where can I find it?


Use latest Slicer Stable or Preview Release and install SlicerVMTK extension.

Centerline Computation module (legacy)

This module is replaced by the much improved, faster and more robust “Extract Centerline” module in current Slicer versions (Slicer-4.11 and later).

This module determines centerlines in a vessel tree from an input model node. Click “Preview” button for a quick validation of the input model and approximate centerline computation. Click “Start” button for full network analysis and computation of all outputs.

Required inputs:

  • Vessel tree model: this can be any tree structure (not just vascular tree but airways, etc.), either created in Segment Editor module or using Level Set Segmentation module. If Segment Editor is used then segmentation node must be exported to model node by right-clicking on the segmentation in Data module and selecting “Export visible segments to models”.
  • Start point: a markups fiducial node containing a single point, this should be placed at the branch of the tree


  • Centerline model: network extraction results (without branch extraction and merging). Points contain centerline points, and “Radius” point data contains maximum inscribed sphere radius at each point.
  • Centerline endpoints: Coordinates of found start point and all detected branch endpoints.
  • Voronoi model (optional): medial surface of the input model (medial surface contains points that are qat equal distance from nearest surface points)
  • Curve tree rool (optional): if a markups curve node is selected then a hierarchy of curve nodes are created from extracted and merged branches. CellId of each branch is saved into the node’s name (and also as node attribute), which can be used for cross-referencing with CellId column of centerline properties table.
  • Centerline properties (optional): if a table node is selected then branch length, average radius, curvature, torsion, and tortuosity is computed for all the extracted and merged branches.