The Vascular Modeling Toolkit

Supported by Orobix srl

vmtk is a collection of libraries and tools for 3D reconstruction, geometric analysis, mesh generation and surface data analysis for image-based modeling of blood vessels.

Learn More

vmtk 1.4.0 released!

Get a free trial of VMTKLab


Segmentation of vascular segments (or other anatomical structures) from medical images


Compute centerlines and maximal inscribed sphere radius of branching tubular structures given their polygonal surface representation

Geometric analysis

Geometric analysis and surface data processing of 3D models of blood vessels

Mesh generation

Surface remeshing, volume meshing and generation of boundary layers of prismatic elements with varying thickness for Computational Fluid Dynamics.

Post processing

Mapping and patching of fluid dynamics variables, particle tracing and more...

Pyping system

PypeS is the glue among vmtk scripts. It allows new scripts to be written easily, to have a common interface and to interact with each other.

Support and consulting

 Custom development and training courses 

Orobix logo

Need support for vmtk? Please use the vmtk official support group.

Need to develop problem-specific algorithms, custom pipelines or dedicated user interfaces?

Orobix srl offers professional support around (but not limited to):

  • automated image segmentation
  • geometric characterization
  • mesh generation
  • computational hemodynamics
  • post processing
  • visualization
  • machine learning
  • data engineering

Contact us

or visit the Orobix website

Gradient-based 3D level sets segmentation

Take a look into the Level Set Segmentation tutorial to learn how to reconstruct the 3D surface of a vascular segment from CT or MR images using level sets.

// Image segmentation
vmtklevelsetsegmentation -ifile image_volume_voi.vti -ofile level_sets.vti
//You can specify different parameters, for example:
-levelsetsfile in order to start from an existing levelset segmentation
-featureimagetype to change featureimage, for example the upwind modality
-featurederivativesigma to use a Gaussian derivative convolution

A new gradient computation modality based on upwind finite differences allows the segmentation of small (down to 1.2 pixels/diameter) vessels. Interactive level sets initialization based on the Fast Marching Method. This includes a brand new method for selecting a vascular segment comprised between two points automatically ignoring side branches, no parameters involved. Segmenting a complex vascular tract comes down to selecting the endpoints of a branch, letting level sets by attracted to gradient peaks with the sole advection term turned on, repeating the operation for all the branches and merging everything in a single model.

Computing centerlines

Take a look into the Computing Centerlines tutorial to learn how to compute centerlines of a vascular segment.

// Computing centerlines
vmtkcenterlines -ifile foo.vtp -ofile foo_centerlines.vtp
//Look the resulting centerlines
vmtksurfacereader -ifile foo.vtp --pipe vmtkcenterlines --pipe vmtkrenderer --pipe vmtksurfaceviewer -opacity 0.25 --pipe vmtksurfaceviewer -i @vmtkcenterlines.o -array MaximumInscribedSphereRadius
//Inspect the voronoi diagram
vmtksurfacereader -ifile foo.vtp --pipe vmtkcenterlines --pipe vmtkrenderer --pipe vmtksurfaceviewer -opacity 0.25 --pipe vmtksurfaceviewer -i @vmtkcenterlines.voronoidiagram -array MaximumInscribedSphereRadius --pipe vmtksurfaceviewer -i @vmtkcenterlines.o
Figure 1

Centerlines are powerful descriptors of the shape of vessels and are determined as weighted shortest paths traced between two extremal points. In order to ensure that the final lines are in fact central, the paths cannot lie anywhere in space, but are bound to run on the Voronoi diagram of the vessel model, considered as the place where the centers of maximal inscribed spheres are defined. Centerlines are determined as the paths defined on Voronoi diagram sheets that minimize the integral of the radius of maximal inscribed spheres along the path, which is equivalent to finding the shortest paths in the radius metric.

Geometric analysis

Take a look into the Geometric analysis tutorial to learn how to analyze the 3D geometry of a vascular segment and into the Preparing a Surface for Meshing tutorial to learn how to prepare a surface for mesh generation.

// Generate a vtp file containing the data on the bifurcation vectors
vmtksurfacereader -ifile foo.vtp --pipe vmtkcenterlines -seedselector openprofiles --pipe vmtkbranchextractor --pipe vmtkbifurcationreferencesystems --pipe vmtkbifurcationvectors -ofile foo_bv.vtp
//Compute curvature and torsion
vmtkcenterlinegeometry -ifile foo_cl.vtp -smoothing 1 -ofile foo_clgm.vtp
//Smoothing a surface
vmtksurfacesmoothing -ifile foo.vtp -passband 0.1 -iterations 30 -ofile foo_sm.vtp 
//Adding flow extensions
vmtksurfacereader -ifile foo.vtp --pipe vmtkcenterlines -seedselector openprofiles --pipe vmtkflowextensions -adaptivelength 1 -extensionratio 20 -normalestimationratio 1 -interactive 0 --pipe vmtksurfacewriter -ofile foo_ex.vtp 
Figure 1

Quantifying geometric features of the vascular segment, those associated to bifurcations, such as bifurcation planes and bifurcation angles, and those associated to branches, such as curvature and torsion. Curvature and torsion are tightly linked to the definition of the Frenet line frame, constituted by a tangent, a normal and the binormal.

Increase surface smoothness prior to building the mesh. Image segmentation can result in bumpy surfaces, especially if the image quality is not high and one didn’t use any curvature term in level sets evolution. Flow extensions are cylindrical extensions added to the inlets and outlets of a model. They are important for ensuring that the flow entering and leaving the computational domain is fully developed, so that fully developed boundary conditions aren’t forcing the solution in the actual vessel.

Generating a mesh

Take a look into the Generating a Mesh tutorial to learn how to generate a mesh from a surface and into Meshing based on centerlines (vmtk+gmsh) tutorial to learn how to generate tetrahedral or mixed hexahedral meshes using vmtk coupled to Gmsh. Contributed by Emilie Marchandise, U. Louvain

// generating a uniform element mesh
vmtkmeshgenerator -ifile foo.vtp -ofile foo.vtu -edgelength 0.5
//Generating a radius-adaptive element mesh
vmtksurfacereader -ifile foo.vtp --pipe vmtkcenterlines -endpoints 1 -seedselector openprofiles --pipe vmtkdistancetocenterlines -useradius 1 --pipe vmtkmeshgenerator -elementsizemode edgelengtharray -edgelengtharray DistanceToCenterlines -edgelengthfactor 0.3 -ofile foo.vtu 
//Adding a boundary layer
vmtksurfacereader -ifile foo.vtp --pipe vmtkcenterlines -endpoints 1 -seedselector openprofiles --pipe vmtkdistancetocenterlines -useradius 1 --pipe vmtkmeshgenerator -elementsizemode edgelengtharray -edgelengtharray DistanceToCenterlines -edgelengthfactor 0.3 -boundarylayer 1 -ofile foo.vtu 
Figure 1

Surface remeshing is performed under the assumption that the surface requires improvement before being used for CFD. After the surface has been remeshed the volume is filled with a combination of tetrahedral and prismatic elements.
We can heighten the density of the mesh near the wall by generating the boundary layer.

Mapping and patching

Take a look into the Mapping and patching tutorial to learn how to map the surface of a population of vessels onto the same parametric space and enable statistical analyses of surface-based quantities

// Longitudinal and circumferential metrics
vmtkbranchmetrics -ifile aorta_clipped.vtp -centerlinesfile aorta_cl.vtp -abscissasarray Abscissas -normalsarray ParallelTransportNormals -groupidsarray GroupIds -centerlineidsarray CenterlineIds -tractidsarray TractIds -blankingarray Blanking -radiusarray MaximumInscribedSphereRadius -ofile aorta_clipped_metrics.vtp
//Metrics mapping to branches
vmtkbranchmapping -ifile aorta_clipped_metrics.vtp -centerlinesfile aorta_cl.vtp -referencesystemsfile aorta_cl_rs.vtp -normalsarray ParallelTransportNormals -abscissasarray Abscissas -groupidsarray GroupIds -centerlineidsarray CenterlineIds -tractidsarray TractIds -referencesystemsnormalarray Normal -radiusarray MaximumInscribedSphereRadius -blankingarray Blanking -angularmetricarray AngularMetric -abscissametricarray AbscissaMetric -ofile aorta_clipped_mapping.vtp
//Patching of surface mesh and attributes
vmtkbranchpatching -ifile aorta_clipped_mapping.vtp -groupidsarray GroupIds -longitudinalmappingarray StretchedMapping -circularmappingarray AngularMetric -longitudinalpatchsize 0.5 -circularpatches 12 -ofile aorta_clipped_patching.vtp
Figure 1

A common application is mapping and patching of fluid dynamics variables, such as wall shear stress (WSS) or oscillatory shear index (OSI), obtained on the surface mesh typically by means of a CFD simulation.
By construction of a harmonic function over each vascular segment, vmtkbranchmapping maps and stretches the longitudinal metric to correctly account for the presence of insertion regions at bifurcations; the additional StretchedMapping array is added to the surface.


Take a look into the Basic PypeS tutorial to learn how to effectively pipe vmtk scripts together, the Use PypeS Programmatically tutorial to learn how to interactively work with PypeS objects and into the Advanced PypeS tutorial to learn how to write your own PypeS modules

vmtkmarchingcubes --help
Creating vmtkMarchingCubes instance.
Automatic piping vmtkmarchingcubes
Parsing options vmtkmarchingcubes
vmtkmarchingcubes : generate an isosurface of given level from a 3D image
Input arguments:
	-id Id(int,1); default=0: script id
	-handle Self (self,1): handle to self
	-disabled Disabled (bool,1); default=0: disable execution and piping
	-i Image (vtkImageData,1): the input image
	-ifile ImageInputFileName(str,1): filename for the default Image Reader
	-array ArrayName (str,1): name of the array to work with
	-l Level(float,1); default=0.0: graylevel to generate the isosurface at
	-connectivity Connectivity (bool,1); default=0: only output the largest connected region of the isosurface
	-ofile SurfaceOutputFileName (str,1): filename for the default Surface writer
Output arguments:
	-id Id (int,1); default= 0: script id
	-handle Self (self,1): handle to self
	-o Surface (vtkPolyData,1): the output surface
// We can use vmtkmarchingcubes as a stand-alone script by using the built-in I/O functionality
vmtkmarchingcubes -ifile foo.vti -ofile foo.vtp
//or we can build a pype that does the same thing
vmtkimagereader -ifile foo.vti --pipe vmtkmarchingcubes --pipe vmtksurfacewriter -ofile foo.vtp @vmtkcenterlines.o -array MaximumInscribedSphereRadius
//Say we want to read two images and extract a surface with Marching Cubes with a level of 20 for both. We can either write
vmtkmarchingcubes -ifile foo1.vti -l 20 --pipe vmtkmarchingcubes -ifile foo2.vti -l 20
//or push the input argument -l along to the second vmtkmarchingcubes this way
vmtkmarchingcubes -ifile foo1.vti -l@ 20 --pipe vmtkmarchingcubes -ifile foo2.vti

Writing classes implementing algorithms and writing actual tools to be used for everyday work are two distinct tasks.
Very often a well-designed object-oriented library ends up to be used in ever-growing collections of shell, Python or Tcl scripts or small C programs, each with its own argument parsing and I/O sections. Very often high-level code is duplicated to provide slightly different functionality. On the other side, writing a GUI is a time-consuming task, and adding new functionality requires time, which might deter experimentation. PypeS goes in the direction of providing a flexible framework for high-level code, both from the user’s and from the developer’s points of view. The user wants to get things done minimizing the work required and the amount of intermediate data generated. The coder wants to limit the amount of code, she/he has to cut and paste (and maintain), and to quickly add new functionality and make it interact with what she/he’s ever written before.

What's New

date icon Monday, March 19, 2018

We are pleased to announce the latest version of VMTK is ready for general use! Please see the documentation below for details.

Python 3 Support

VMTK now supports the following python versions for each platform:

  • Linux (Many Linux Compatible): 2.7, 3.5, 3.6+
  • MacOSX (Minimum MacOS 10.9): 2.7, 3.5, 3.6+
  • Windows 10: 3.5, 3.6+

Packaging and Distribution via Anaconda

VMTK has officially embraced the Anaconda Python packaging and distribution system for dependency and code management. Official releases are posted to the VMTK Anaconda Channel. Our Installation Instruction have been updated on the VMTK webpage to reflect the change.

Executable installers are also available at the VMTK Downloads Page.

In the future, we plan to also post releases to the conda-forge Anaconda channel. We are waiting for conda-forge to support VTK on MacOSX before making this transition.

Please note: we will no longer be releasing new versions of VMTK on PyPi

Native Conversion of VMTK Data Structures to Numpy Arrays

We now allow you to use all of the functionality that VMTK offers in filtering images, creating surfaces, centerlines, or volumetric meshes, while seemlessly being able to employ any external processing available in the scientific python ecosystem. With the following new methods, you can losslesly translate data (generated in either VMTK or in Python proper) back and forth between the VTK data formats and Numpy Arrays:

A tutorial has been provided on the VMTK website which walks you through the process of interacting with the translation routines

Store Data to Disk as HDF5 or Pickled Python Files

With the VMTK-Numpy conversion utilities, we now allow VMTK data structures to be saved (and read) to disk as HDF5 or Python Pickle objects. These methods are available in the following methods:

Pype Scripts Include Sensible Default Values

It is now significantly easier to break up pypes run on the command line. Instead of relying on output members to specify input array names for scripts down the pype, we now include sensible defaults to the input array names. It is now possible to run one set of commands which generate a surface/centerline from an image, write those files to disk, and run another set of commands which perform further calculations or visualizations with no need to respecify array names.

To demonstrate this consider the following example where we have previously generated centerlines from a surface and saved it to disk as a centerlines.vtp file. If we later decide that we wanted to split the centerlines into their respective branches (see the branch splitting tutorial for details), we would previously have had to specify the array name where the maximum inscribed sphere radius was stored (ie. MaximumInscribedSphereRadius by default) as shown in the following pype script:

vmtkbranchextractor -ifile centerlines.vtp -radiusarray MaximumInscribedSphereRadius -ofile centerlines_split.vtp

With this update, if you did not specifically change the default names for the data arrays during creation of the centerlines file it will be filled in for you, and following pypescript will work as intended:

vmtkbranchextractor -ifile centerlines.vtp -ofile centerlines_split.vtp

It should be noted that this does not require any change in workflows that are already predefined. Any manually specified pype argument will override the default value. The same goes for vmtkscripts which are run from within a conventional python file. The default values have been updated on the VMTK Docs Webpage.

VTK & ITK Versions

VTK 8.1 is the default which will be distributed with binary packages. Custom builds should be able to use back to VTK 6.

ITK 4.13.0 is the default which is distributed with binary packages. Custom builds should be able to use back to ITK 4.9

Significant Backend Changes and Modernization

The VMTK build system and community workflows have undergone significant updates. We’ve documented the new process in our Contributing Guidelines. Changes of particular significance are:

  • Unit Testing and Continuous Integration - We’ve built a PyTest based unit-test framework from scratch, and are using Travis-CI and Appveyor to test pull requests.
  • Modernization of Our CMake Build System to improve local development builds. Activation of a development build no longer modifies LD_LIBRARY_PATH on Linux, or DYLD_LIBRARY_PATH on MacOSX. We have transitioned from CMAKE_MINIMUM_REQURED(2.8) to Version 3.4.
  • External projects depending on VMTK should note that we now export VMTK-Targets in our cmake install methods.
  • Overhaul our packaging & distribution system to allow for regular symantic version releases.

Script Improvements:

  • #249 Add additional smoothing filter to vmtkimagesmoothing using ITK an-isotropic diffusion.
  • #247 Font size scales based on display screen size.
  • #233 Fix vmtkbranchclipper with insideout enabled.
  • #200 Modify vmtksurfaceendclipper to clip based on centerline information
  • Many bugfixes

New Python Requirements

With this release, the following python packages are requirements of VMTK. Please note that this is included soley for informational purposes (and developers who intend to build from source). The VMTK anaconda package (and windows installer) will automatically solve and configure the dependencies appropriatly for your system and current environment.

  • Numpy <=1.13 (mkl preffered, but nomkl or openblas will work as well)
  • H5Py >=2.7
  • hdf5 >=1.18
  • future

Breaking Changes

  • Python 2.7 is no longer supported on Windows.
  • No further packages will be released on the VMTK PyPi channel.
  • Removed ability to read in DICOM files specified only via a directory path (pypescript -d argument). See #220


Thank you to the following people for dedicating their time and effort into making VMTK 1.4 possible!


date-icon Monday, March 19, 2018 announcement
We would like to officially welcome Richard (Rick) Izzo to the VMTK development team. Rick has a long history of contributing to the project, and...
date-icon Monday, November 13, 2017 announcement
EPFL has developed an add-on for Blender that loads centerlines generated by VMTK into Blender, and writes meshes from Blender so that they can be...
date-icon Tuesday, October 31, 2017 announcement
vmtk 1.4 for OSX has been released on Oct 31, 20187. We currently distribute vmtk for OSX using conda. Releases for Windows and Linux will...
For more, visit our
News archive