A lightweight and powerful python module
for scientific analysis and visualization of 3d objects.
Inspired by the vpython manifesto "3D programming for ordinary mortals",
vedo
makes it easy to work with 3D pointclouds, meshes and volumes,
in just a few lines of code, even for less experienced programmers.
vedo
is based on VTK and numpy,
with no other dependencies.
pip install vedo
additional installation details [click to expand]
-
To install the latest dev version of
vedo
:
pip install -U git+https://github.com/marcomusy/vedo.git
-
To install from the conda-forge channel:
conda install -c conda-forge vedo
-
Sometimes an older version of VTK can yield better visualizations with transparent objects, to install it use:
pip install vtk==8.1.2
(if available on your system). -
To use in jupyter notebooks use function
vedo.embedWindow()
, you may want to installk3d
with:
pip install k3d==2.7.4
The webpage of the library with documentation is available here.
📌 Need help? Have a question, or wish to ask for a missing feature?
Do not hesitate to open a issue
The library includes a large set of working examples for a wide range of functionalities:
working with polygonal meshes and point clouds [click to expand]
- Import meshes from VTK format, STL, Wavefront OBJ, 3DS, Dolfin-XML, Neutral, GMSH, OFF, PCD (PointCloud),
- Export meshes as ASCII or binary to VTK, STL, OBJ, PLY ... formats.
- Analysis tools like Moving Least Squares, mesh morphing and more..
- Tools to visualize and edit meshes (cutting a mesh with another mesh, slicing, normalizing, moving vertex positions, etc..).
- Split mesh based on surface connectivity. Extract the largest connected area.
- Calculate areas, volumes, center of mass, average sizes 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, determine if a point lies inside or outside of a mesh.
- Create primitive shapes: spheres, arrows, cubes, torus, ellipsoids...
- Generate glyphs (associate a mesh to every vertex of a source mesh).
- Create animations easily by just setting the position of the displayed objects in the 3D scene. Add trailing lines and shadows to moving objects is supported.
- Straightforward support for multiple sync-ed or independent renderers in the same window.
- Registration (alignment) of meshes with different techniques.
- Mesh smoothing.
- Delaunay triangulation in 2D and 3D.
- Generate meshes by joining nearby lines in space.
- Find the closest path from one point to another, traveling along the edges of a mesh.
- Find the intersection of a mesh with lines, planes or other meshes.
- Interpolate scalar and vectorial fields with Radial Basis Functions and Thin Plate Splines.
- Add sliders and buttons to interact with the scene and the individual objects.
- Visualization of tensors.
- Analysis of Point Clouds:
- Moving Least Squares smoothing of 2D, 3D and 4D clouds
- Fit lines, planes, spheres and ellipsoids in space
- Identify outliers in a distribution of points
- Decimate a cloud to a uniform distribution.
working with volumetric data and tetrahedral meshes
- Import data from VTK format volumetric TIFF stacks, DICOM, SLC, MHD and more
- Import 2D images as PNG, JPEG, BMP
- Isosurfacing of volumes
- Composite and maximum projection volumetric rendering
- Generate volumetric signed-distance data from an input surface mesh
- Probe volumes with lines and planes
- Generate stream-lines and stream-tubes from vectorial fields
- Slice and crop volumes
- Support for other volumetric structures (structured and grid data)
plotting and histogramming in 2D and 3D
- Polygonal 3D text rendering with Latex-like syntax and unicode characters, with 14 different fonts.
- Fully customizable axis styles
- donut plots and pie charts
- Scatter plots in 2D and 3D
- Surface function plotting
- 1D customizable histograms
- 2D hexagonal histograms
- Polar plots, spherical plots and histogramming
- Draw latex-formatted formulas in the rendering window.
- Quiver, violin, whisker and stream-line plots
- Graphical markers analogous to matplotlib
integration with other libraries
- Integration with the Qt5 framework.
- Support for FEniCS/Dolfin platform for visualization of PDE/FEM solutions.
- Interoperability with the trimesh, pyvista and pymeshlab libraries.
- Export 3D scenes and embed them into a web page.
- Embed 3D scenes in jupyter notebooks with K3D (can export an interactive 3D-snapshot page here).
Visualize a polygonal mesh or a volume from a terminal window simply with:
vedo https://vedo.embl.es/examples/data/embryo.tif
Volumetric files (mhd, vti, slc, tiff, DICOM etc..) can be visualized in different modes:
Volume 3D slicingvedo --slicer embryo.slc |
Ray-castingvedo -g |
2D slicingvedo --slicer2d |
Colorize voxelsvedo --lego |
---|---|---|---|
Type vedo -h
for the complete list of options.
vedo
currently includes 300+ working examples and notebooks.
Work with volumes, tetrahedral and polygonal meshes. | Interoperability with external libraries like FEniCs, trimesh, meshio, pyvista, and pymeshlab. | Animations of physical systems (above, a system of reaction-diffusion). |
Run any of the built-in examples. In a terminal type: vedo -r earthquake_browser
Check out the example galleries organized by subject here:
Scientific publications leveraging vedo
:
- X. Diego et al.: "Key features of Turing systems are determined purely by network topology", Physical Review X, 20 June 2018.
- M. Musy, K. Flaherty et al.: "A Quantitative Method for Staging Mouse Limb Embryos based on Limb Morphometry", Development, 5 April 2018, doi: 10.1242/dev.154856.
- G. Dalmasso et al., "Evolution in space and time of 3D volumetric images", in preparation.
- F. Claudi, A. L. Tyson, T. Branco, "Brainrender. A python based software for visualisation of neuroanatomical and morphological data.", DOI.
- J. S. Bennett, D. Sijacki, "Resolving shocks and filaments in galaxy formation simulations: effects on gas properties and star formation in the circumgalactic medium", Monthly Notices of the Royal Astronomical Society, Vol. 499, Issue 1, Nov. 2020, DOI.
- J.D.P. Deshapriya et al., "Spectral analysis of craters on (101955) Bennu". (DOI: 10.1016/j.icarus.2020.114252)
- A. Pollack et al., *"Stochastic inversion of gravity, magnetic, tracer, lithology, and fault data for geologically realistic structural models: Patua Geothermal Field case study" Geothermics Volume 95, September 2021, doi: 10.1016/j.geothermics.2021.102129.
- X. Lu et al., "3D electromagnetic modeling of graphitic faults in the Athabasca Basin using a finite-volume time-domain approach with unstructured grids" doi: 10.1190.
Have you found this software useful for your research? Star ✨ the project and cite it as:
M. Musy et al.,
"vedo
, a python module for scientific analysis and visualization of 3D objects and point clouds",
Zenodo, 2021, doi: 10.5281/zenodo.4609336.