https://user-images.githubusercontent.com/32848391/52522718-50d83880-2c89-11e9-80ff-df1b5618a84a.png


Downloads lics pythvers Documentation Built by gendocs https://zenodo.org/badge/DOI/10.5281/zenodo.2561402.svg

A python module for scientific visualization, analysis and animation of 3D objects and point clouds based on VTK and numpy.

Download and Install:

pip install vtkplotter

Check out the Git repository here: https://github.com/marcomusy/vtkplotter

Features:

Intuitive and straightforward API which can be combined with VTK seamlessly in a program, whilst mantaining access to the full range of VTK native classes.

It includes a large set of working examples for the all following functionalities:

  • Import meshes from VTK format, STL, Wavefront OBJ, 3DS, XML, Neutral, GMSH, PCD (PointCloud), volumetric TIFF stacks, SLC, MHD, 2D images PNG, JPEG.

  • Export meshes as ASCII or binary to VTK, STL, PLY formats with command vtkconvert.

  • Mesh analysis through the built-in methods of VTK package. Additional analysis tools like Moving Least Squares, mesh morphing.

  • Tools to visualize and edit meshes (cutting a mesh with another mesh, slicing, normalizing, moving vertex positions, etc..). Interactive cutter widget.

  • Split mesh based on surface connectivity. Extract the largest connected area.

  • Calculate mass properties, like area, volume, center of mass, average size etc.

  • Calculate vertex and face normals, curvatures, feature edges. Fill mesh holes.

  • Subdivide faces of a mesh, increasing the number of vertex points. Mesh simplification.

  • Coloring and thresholding of meshes based on associated scalar or vectorial data.

  • Point-surface operations: find nearest points, check if a point lies inside or outside a mesh.

  • Create primitive objects like: spheres, arrows, cubes, torus, ellipsoids…

  • Generate glyphs (associating a mesh to each vertex of a source mesh).

  • Create animations easily by just defining the position of the displayed objects in the 3D scene. Add trailing lines to moving objects automatically.

  • Straightforward support for multiple sync-ed or independent renderers in the same window.

  • Registration (alignment) of meshes with different techniques.

  • Mesh smoothing with Laplacian and WindowedSinc algorithms.

  • Delaunay triangulation in 2D and 3D.

  • Generate meshes by joining nearby lines in space.

  • Find the closest path from one point to another, travelling along the edges of a mesh.

  • Find the intersection of a mesh with a line (or with another mesh).

  • Analysis of Point Clouds:

    • Moving Least Squares smoothing of 2D, 3D and 4D clouds
    • Fit lines, planes and spheres in space
    • Perform PCA (Principal Component Analysis) on point coordinates
    • Identify outliers in a distribution of points
    • Decimate a cloud to a uniform distribution.
  • Basic histogramming and function plotting in 1D and 2D.

  • Interpolate scalar and vectorial fields with Radial Basis Functions and Thin Plate Splines.

  • Analysis of volumetric datasets:

    • Isosurfacing of volumes
    • Direct maximum projection rendering
    • Generate volumetric signed-distance data from an input surface mesh
    • Probe a volume with lines and planes.
  • Add sliders and buttons to interact with the scene and the individual objects.

  • Fully customizable axis style.

  • Examples with SHTools package for spherical harmonics expansion of a mesh shape.

  • Integration with the Qt5 framework.

  • Draw latex-formatted formulas on the rending window.

  • Export a 3D scene and embed it into a html page.

  • Support for FEniCS/dolfin package.

Hello World example

In your python script, load a simple 3DS file and display it:

from vtkplotter import show

show('data/shapes/flamingo.3ds')
flam

Allowed input objects to the show() command are:
filename, vtkPolyData, vtkActor, vtkActor2D, vtkImageActor, vtkAssembly or vtkVolume.

Command-line interface

Visualize a mesh with:

vtkplotter mesh.obj
# valid formats: [vtk,vtu,vts,vtp,vtm,ply,obj,stl,3ds,dolfin-xml,neutral,gmsh,
#                 pcd,xyz,txt,byu,tif,off,slc,vti,mhd,dicom,dem,nrrd,bmp,png,jpg]

Voxel-data (mhd, vti, slc, tiff, dicom) files can also be visualized with options -g, e.g.:

vtkplotter -g examples/data/embryo.slc
https://user-images.githubusercontent.com/32848391/58336107-5a09a180-7e43-11e9-8c4e-b50e4e95ae71.gif

To visualize multiple files or files time-sequences try -n or -s options. Use -h for the complete list of options.

Use a slider to control isosurfacing of a volume:

vtkplotter examples/data/head.vti
https://user-images.githubusercontent.com/32848391/56972083-a7f3f800-6b6a-11e9-9cb3-1047b69dcad2.gif

Load and browse a sequence of meshes:

vtkplotter -s examples/data/timecourse1d/*.vtk
https://user-images.githubusercontent.com/32848391/58336919-f7b1a080-7e44-11e9-9106-f574371093a8.gif

Visualize colorized voxels:

vtkplotter --lego examples/data/embryo.slc
https://user-images.githubusercontent.com/32848391/56969949-71b47980-6b66-11e9-8251-4bbdb275cb22.jpg