A python module for scientific visualization, analysis of 3D objects and point clouds.
npx @tessl/cli install tessl/pypi-vedo@2025.5.0A comprehensive Python library for scientific visualization and analysis of 3D objects, meshes, volumes, and point clouds built on top of VTK (Visualization Toolkit). Vedo provides an intuitive, high-level interface for creating interactive 3D visualizations, processing geometric data, and performing scientific analysis tasks with extensive support for various file formats, advanced rendering features, and seamless integration into Jupyter notebooks.
pip install vedoimport vedoCommon import patterns:
# Import specific classes and functions
from vedo import Mesh, Points, Volume, Plotter, show
# Import plotting functions
from vedo import plot, histogram
# Import shape generation functions
from vedo import Sphere, Box, Line, Text3D
# Import utilities
from vedo import load, save, printcimport vedo
from vedo import Sphere, Box, Plotter, show
# Create 3D objects
sphere = Sphere(pos=(0, 0, 0), r=1.0, c='red')
box = Box(pos=(2, 0, 0), length=1.5, width=1.0, height=0.8, c='blue')
# Simple visualization
show(sphere, box, title="Basic 3D Scene")
# Advanced plotting with Plotter
plt = Plotter(title="Interactive Scene")
plt.add(sphere)
plt.add(box)
plt.show()
# Load and visualize 3D files
mesh = vedo.load("model.stl")
mesh.color('green').alpha(0.8)
show(mesh)
# Point cloud analysis
points = vedo.Points([[0,0,0], [1,1,1], [2,0,1]], c='orange')
fitted_plane = vedo.fit_plane(points)
show(points, fitted_plane)Vedo's architecture is built around VTK with intuitive Python interfaces:
The design provides both high-level convenience functions and low-level VTK access, enabling everything from quick data visualization to complex scientific applications.
Primary classes for representing and manipulating 3D data including meshes, point clouds, volumetric data, and 2D images. These objects provide the foundation for all visualization and analysis operations.
class Mesh(MeshVisual, Points):
def __init__(self, inputobj=None, c="gold", alpha=1): ...
class Points(PointsVisual, PointAlgorithms):
def __init__(self, inputobj=None, r=4, c="red", alpha=1): ...
class Volume(VolumeAlgorithms, VolumeVisual):
def __init__(self, inputobj=None, c="RdYlBu_r", alpha=(0.0, 0.0, 0.2, 0.4, 0.8, 1.0)): ...
class Image(ImageVisual):
def __init__(self, obj=None, channels=3): ...Comprehensive library of 3D shape primitives, geometric constructions, and procedural generation tools. Includes basic shapes, curves, splines, text rendering, and complex geometric forms.
class Sphere:
def __init__(self, pos=(0, 0, 0), r=1, res=24, quads=False, c="red", alpha=1): ...
class Box:
def __init__(self, pos=(0, 0, 0), length=1, width=1, height=1, c="gold", alpha=1): ...
class Line:
def __init__(self, p0, p1=None, res=1, lw=1, c="red", alpha=1): ...
class Text3D:
def __init__(self, txt, pos=(0, 0, 0), s=1, font="", hspacing=1.15, vspacing=2.15, depth=0, italic=False, justify="bottom-left", c="black", alpha=1): ...Main visualization system including the Plotter class for scene management, matplotlib-style pyplot interface, and specialized plotting functions for scientific data visualization.
class Plotter:
def __init__(self, shape=(1, 1), N=None, pos=(0, 0), size="auto", screensize="auto", title="vedo", bg="white", bg2=None, axes=None): ...
def show(*objects, **kwargs): ...
def plot(*args, **kwargs): ...
def histogram(*args, **kwargs): ...
def fit(points, deg=1, niter=1000, nstd=3): ...Comprehensive file format support for loading and saving 3D data, with functions for various mesh formats, volumetric data, images, and specialized scientific data formats.
def load(filename, unpack=True, force=False): ...
def save(obj, filename, binary=True): ...
def download(url, filename=None, force=False, verbose=True): ...
def screenshot(filename="screenshot.png", scale=1, asarray=False): ...Color management system including color conversion functions, colormap application, palette generation, and visual styling utilities for enhancing 3D visualizations.
def get_color(rgb=None, hsv=None): ...
def color_map(value, name="jet", vmin=None, vmax=None): ...
def build_palette(color1, color2, n, hsv=True): ...
def printc(*strings, c=None, bc=None, bold=False, italic=False, blink=False, underline=False, strike=False, dim=False, invert=False, box="", end="\\n", flush=False): ...Geometric transformation utilities, coordinate system conversions, and spatial analysis functions for manipulating and analyzing 3D data.
class LinearTransform:
def __init__(self, T): ...
def cart2spher(x, y, z): ...
def spher2cart(rho, theta, phi): ...
def fit_plane(points, signed=False): ...
def fit_sphere(coords): ...Interactive widgets and UI elements including sliders, buttons, scalar bars, legends, and measurement tools for creating interactive 3D applications.
class Slider2D:
def __init__(self, func, xmin, xmax, value=None, pos=4, title="", font="Calco", titleSize=1, c=None, alpha=1, showValue=True, delayed=False, **options): ...
class ScalarBar:
def __init__(self, obj, title="", pos=(0.775, 0.05), titleYOffset=15, titleFontSize=12, size=(None, None), nlabels=None, c=None, horizontal=False, useAlpha=True): ...
class Light:
def __init__(self, pos, focalPoint=(0, 0, 0), deg=180, c="white", intensity=1): ...Advanced algorithms for geometric analysis, point cloud processing, mesh operations, and scientific computations including fitting, clustering, and morphological operations.
def merge(*meshs, flag=False): ...
def pca_ellipse(points, pvalue=0.673, res=60): ...
def procrustes_alignment(sources, rigid=False): ...
class ProgressBar:
def __init__(self, start, stop, step=1, c="red", title="", width=24, char="█", bg="", logFile=None, delay=-1, ETA=True): ...Ready-to-use applications for common scientific visualization tasks including volume slicing, isosurface browsing, interactive drawing, animation creation, and morphing between 3D objects.
class Slicer3DPlotter(Plotter):
def __init__(self, volume, cmaps=("gist_ncar_r", "hot_r", "bone"), clamp=True, show_histo=True): ...
class IsosurfaceBrowser(Plotter):
def __init__(self, volume, isovalue=None, c="gold", alpha=1.0, cmap="hot"): ...
class FreeHandCutPlotter(Plotter):
def __init__(self, obj, splined=True, font="", alpha=1.0): ...
class AnimationPlayer(Plotter):
def __init__(self, sequence, fps=24, loop=True, show_controls=True): ...# Core type aliases
from typing import Union, List, Tuple, Optional, Any
import numpy as np
# Common type patterns used throughout vedo
ColorLike = Union[str, Tuple[float, float, float], List[float]]
PointLike = Union[List[float], Tuple[float, float, float], np.ndarray]
MeshLike = Union[str, "Mesh", "Points", "vtk.vtkPolyData", "vtk.vtkActor"]