vedo is a fast and lightweight python module for scientific analysis and visualization of 3d objects.
Not limited to 3d, vedo can also generate high quality renderings in 2d (scatter plots, histograms etc).
Inspired by the vpython manifesto “3D programming for ordinary mortals”, vedo makes it easy to work wth three-dimensional objects, create displays and animations in just a few lines of code, even for those with less programming experience.
Download and Install:¶
pip install vedo
Check out the Git repository here: https://github.com/marcomusy/vedo
Windows-10 users can manually place this file vedo.bat on the desktop to drag&drop files to visualize. (Need to edit the path of their local python installation).
The module includes a large set (300+) 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.
Visualization of tensors.
Embed the 3D rendering in a jupyter notebook with the K3D backend.
Export a 3D scene and embed it into a web page.
Interoperability with the trimesh library.
Hello World examples¶
Use command line to un any of the built-in examples. In a terminal, type:
vedo -r covid19
Visualize a file from web URL (or your dropbox!), type:
Visualize a whole scene, type:
Visualize any polygonal mesh. Voxel-data (mhd, vti, slc, tiff, dicom) files can also be visualized with options -g, e.g.:
vedo -g https://vedo.embl.es/examples/data/embryo.slc # 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]
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:
Visualize colorized voxels:
vedo --lego https://vedo.embl.es/examples/data/embryo.tif
Run any of the available scripts from with:
vedo --list vedo -r covid19
More than 300 examples can be found in directories:
Apply a Moving Least Squares algorithm to obtain a smooth surface from a to a large cloud of scattered points in space (moving_least_squares2D.py):
Simulation of a gyroscope hanging from a spring (gyroscope1.py):
Quantum-tunnelling effect integrating the Schroedinger equation with 4th order Runge-Kutta method. The animation shows the evolution of a particle in a box hitting a sinusoidal potential barrier (tunnelling2.py):
Visualizing a Turing system of reaction-diffusion between two molecules (grayscott.py):
Mesh format conversion¶
vedo-convert can be used to convert multiple files from a format to a different one:
Usage: vedo-convert [-h] [-to] [files [files ...]] allowed targets formats: [vtk, vtp, vtu, vts, ply, stl, byu, xml] Example: > vedo-convert myfile.vtk -to ply