CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-vedo

A python module for scientific visualization, analysis of 3D objects and point clouds.

Overview
Eval results
Files

applications.mddocs/

Specialized Applications

Ready-to-use specialized applications built on top of vedo for common scientific visualization tasks. These applications provide complete interactive visualization environments for specific use cases like volume slicing, isosurface browsing, morphing animations, and more.

Capabilities

Volume Slicing Applications

Interactive applications for exploring 3D volumetric data through various slicing and visualization techniques.

class Slicer3DPlotter(Plotter):
    """
    Generate a rendering window with interactive slicing planes for Volume data.
    
    Parameters:
    - volume: vedo.Volume
        Input volume data to slice
    - cmaps: tuple, default ("gist_ncar_r", "hot_r", "bone", "bone_r", "jet", "Spectral_r")
        List of color maps to cycle through
    - clamp: bool, default True
        Clamp scalar range to reduce color mapping artifacts
    - use_slider3d: bool, default False
        Show 3D sliders attached along axes
    - show_histo: bool, default True
        Show histogram on bottom left
    - show_icon: bool, default True
        Show small 3D rendering icon of volume
    - draggable: bool, default False
        Make the 3D icon draggable
    - at: int, default 0
        Subwindow number to plot to
    """
    def __init__(
        self,
        volume: vedo.Volume,
        cmaps=("gist_ncar_r", "hot_r", "bone", "bone_r", "jet", "Spectral_r"),
        clamp=True,
        use_slider3d=False,
        show_histo=True,
        show_icon=True,
        draggable=False,
        at=0,
        **kwargs,
    ): ...

class Slicer3DTwinPlotter(Plotter):
    """
    Compare two volumes side-by-side with synchronized slicing controls.
    
    Parameters:
    - volume1: vedo.Volume
        First volume for comparison
    - volume2: vedo.Volume
        Second volume for comparison
    - clamp1: bool, default True
        Clamp scalar range for first volume
    - clamp2: bool, default True
        Clamp scalar range for second volume
    - alpha1: float, default 1.0
        Transparency for first volume
    - alpha2: float, default 1.0
        Transparency for second volume
    """
    def __init__(
        self,
        volume1: vedo.Volume,
        volume2: vedo.Volume,
        clamp1=True,
        clamp2=True,
        alpha1=1.0,
        alpha2=1.0,
        **kwargs,
    ): ...

class Slicer2DPlotter(Plotter):
    """
    2D slice viewer with interactive controls for volume data.
    
    Parameters:
    - volume: vedo.Volume
        Input volume data
    - size: tuple, default (900, 700)
        Window size
    - bg: str, default "white"
        Background color
    - axes: int, default 7
        Axes configuration
    """
    def __init__(
        self,
        volume: vedo.Volume,
        size=(900, 700),
        bg="white",
        axes=7,
        **kwargs,
    ): ...

class RayCastPlotter(Plotter):
    """
    Ray casting volume renderer with interactive transfer function control.
    
    Parameters:
    - volume: vedo.Volume
        Input volume data
    - bg: str, default "white"
        Background color
    - bg2: str, optional
        Second background color for gradient
    - crop: bool, default False
        Enable cropping functionality
    """
    def __init__(
        self,
        volume: vedo.Volume,
        bg="white",
        bg2=None,
        crop=False,
        **kwargs,
    ): ...

Isosurface and Data Browsing

Applications for exploring scalar field data through isosurfaces and interactive browsing.

class IsosurfaceBrowser(Plotter):
    """
    Interactive browser for exploring isosurfaces at different scalar values.
    
    Parameters:
    - volume: vedo.Volume
        Input volume data
    - isovalue: float, optional
        Initial isovalue for isosurface
    - c: str, default "gold"
        Isosurface color
    - alpha: float, default 1.0
        Isosurface transparency
    - lego: bool, default False
        Show lego-style visualization
    - cmap: str, default "hot"
        Colormap for scalar values
    """
    def __init__(
        self,
        volume: vedo.Volume,
        isovalue=None,
        c="gold",
        alpha=1.0,
        lego=False,
        cmap="hot",
        delayed=False,
        **kwargs,
    ): ...

class Browser(Plotter):
    """
    Generic browser for navigating through sequences of objects or files.
    
    Parameters:
    - objects: list
        List of objects or file paths to browse
    - sliders: bool, default True
        Show navigation sliders
    """
    def __init__(
        self,
        objects,
        sliders=True,
        **kwargs,
    ): ...

Interactive Drawing and Cutting

Applications for interactive drawing, sketching, and cutting operations on 3D objects.

class FreeHandCutPlotter(Plotter):
    """
    Interactive free-hand cutting tool for 3D meshes.
    
    Parameters:
    - obj: vedo.Mesh
        Input mesh to cut
    - splined: bool, default True
        Use splined cutting curves
    - font: str, default ""
        Font for UI text
    - alpha: float, default 1.0
        Mesh transparency
    """
    def __init__(
        self,
        obj: vedo.Mesh,
        splined=True,
        font="",
        alpha=1.0,
        **kwargs,
    ): ...

class SplinePlotter(Plotter):
    """
    Interactive spline drawing and editing application.
    
    Parameters:
    - points: list, optional
        Initial control points for spline
    - splined: bool, default True
        Create smooth spline curves
    - closed: bool, default False
        Create closed spline curves
    - font: str, default ""
        Font for UI elements
    """
    def __init__(
        self,
        points=(),
        splined=True,
        closed=False,
        font="",
        **kwargs,
    ): ...

Animation and Morphing

Applications for creating and controlling animations, morphing between shapes, and temporal data visualization.

class MorphPlotter(Plotter):
    """
    Interactive morphing animation between two or more 3D objects.
    
    Parameters:
    - start_mesh: vedo.Mesh
        Starting mesh for morphing
    - end_mesh: vedo.Mesh
        Target mesh for morphing
    - alpha: float, default 1.0
        Mesh transparency
    - lw: float, default 0.1
        Line width for wireframe
    """
    def __init__(
        self,
        start_mesh: vedo.Mesh,
        end_mesh: vedo.Mesh,
        alpha=1.0,
        lw=0.1,
        **kwargs,
    ): ...

class AnimationPlayer(vedo.Plotter):
    """
    Player for animating sequences of 3D objects with playback controls.
    
    Parameters:
    - sequence: list
        List of objects to animate
    - fps: float, default 24
        Frames per second for playback
    - loop: bool, default True
        Loop animation continuously
    - show_controls: bool, default True
        Show playback control buttons
    """
    def __init__(
        self,
        sequence,
        fps=24,
        loop=True,
        show_controls=True,
        **kwargs,
    ): ...

class Animation(Plotter):
    """
    Base class for creating custom animations with vedo objects.
    
    Parameters:
    - total_duration: float, default 2.0
        Total animation duration in seconds
    - time_range: tuple, default (0, 2)
        Time range for animation
    - show_progressbar: bool, default True
        Show progress bar during animation
    """
    def __init__(
        self,
        total_duration=2.0,
        time_range=(0, 2),
        show_progressbar=True,
        **kwargs,
    ): ...
    
    def fade_in(self, obj, t=None, alpha=1.0):
        """
        Add fade-in effect for an object.
        
        Parameters:
        - obj: vedo object
            Object to fade in
        - t: float, optional
            Time when fade-in completes
        - alpha: float, default 1.0
            Target alpha value
        """
    
    def fade_out(self, obj, t=None, alpha=0.0):
        """
        Add fade-out effect for an object.
        
        Parameters:
        - obj: vedo object
            Object to fade out
        - t: float, optional
            Time when fade-out completes
        - alpha: float, default 0.0
            Target alpha value
        """
    
    def move(self, obj, pt1, pt2, t1=None, t2=None):
        """
        Animate object movement between two points.
        
        Parameters:
        - obj: vedo object
            Object to move
        - pt1: tuple
            Starting position
        - pt2: tuple
            Ending position
        - t1: float, optional
            Start time
        - t2: float, optional
            End time
        """
    
    def rotate(self, obj, axis, angle, t1=None, t2=None):
        """
        Animate object rotation.
        
        Parameters:
        - obj: vedo object
            Object to rotate
        - axis: tuple
            Rotation axis direction
        - angle: float
            Rotation angle in degrees
        - t1: float, optional
            Start time
        - t2: float, optional
            End time
        """
    
    def scale(self, obj, factor, t1=None, t2=None):
        """
        Animate object scaling.
        
        Parameters:
        - obj: vedo object
            Object to scale
        - factor: float
            Scaling factor
        - t1: float, optional
            Start time
        - t2: float, optional
            End time
        """

Utility Classes

Additional utility classes for specialized visualization needs.

class Clock(vedo.Assembly):
    """
    Create a clock-like visualization showing time progression.
    
    Parameters:
    - t: float, default 0
        Initial time value
    - font: str, default "Bongas"
        Font for time display
    - r1: float, default 0.1
        Inner radius
    - r2: float, default 1
        Outer radius
    - thickness: float, default 0.02
        Clock hand thickness
    """
    def __init__(
        self,
        t=0,
        font="Bongas",
        r1=0.1,
        r2=1,
        thickness=0.02,
        c="k",
        bc="t",
        alpha=1,
        ma=0.5,
    ): ...
    
    def update(self, t):
        """
        Update clock display to show new time.
        
        Parameters:
        - t: float
            New time value to display
        """

Usage Examples

import vedo
import numpy as np

# Volume slicing application
volume_data = np.random.rand(50, 50, 50)
volume = vedo.Volume(volume_data)

# Create interactive 3D slicer
slicer = vedo.Slicer3DPlotter(
    volume,
    show_histo=True,
    show_icon=True,
    draggable=True
)
slicer.show()

# Compare two volumes side-by-side
volume1 = vedo.Volume(np.random.rand(40, 40, 40))
volume2 = vedo.Volume(np.random.rand(40, 40, 40) * 2)

twin_slicer = vedo.Slicer3DTwinPlotter(
    volume1, volume2,
    alpha1=0.8, alpha2=0.8
)
twin_slicer.show()

# Interactive isosurface browser
iso_browser = vedo.IsosurfaceBrowser(
    volume,
    c="gold",
    alpha=0.7,
    cmap="plasma"
)
iso_browser.show()

# Free-hand mesh cutting
mesh = vedo.Sphere(r=2, res=50)
cutter = vedo.FreeHandCutPlotter(
    mesh,
    splined=True,
    alpha=0.8
)
cutter.show()

# Interactive spline drawing
spline_tool = vedo.SplinePlotter(
    splined=True,
    closed=False
)
spline_tool.show()

# Morphing animation between shapes
sphere = vedo.Sphere(r=1, res=50)
cube = vedo.Box(size=2).triangulate()

morph_app = vedo.MorphPlotter(
    sphere, cube,
    alpha=0.8
)
morph_app.show()

# Animation with custom effects
animation = vedo.Animation(total_duration=5.0)

# Create objects for animation
obj1 = vedo.Sphere(c='red').pos(-3, 0, 0)
obj2 = vedo.Box(c='blue').pos(3, 0, 0)

# Add animation effects
animation.fade_in(obj1, t=1.0)
animation.move(obj1, (-3, 0, 0), (0, 0, 0), t1=1.0, t2=3.0)
animation.rotate(obj2, axis=(0, 0, 1), angle=360, t1=0, t2=5.0)
animation.fade_out(obj2, t=4.0)

animation.show()

# Browse through sequence of objects
objects = [vedo.Sphere(), vedo.Box(), vedo.Cylinder(), vedo.Cone()]
browser = vedo.Browser(objects, sliders=True)
browser.show()

# Ray casting volume renderer
ray_caster = vedo.RayCastPlotter(
    volume,
    bg="black",
    crop=True
)
ray_caster.show()

# Animation player for object sequences
frames = []
for i in range(20):
    sphere = vedo.Sphere(r=1 + 0.1*i, c=i)
    frames.append(sphere)

player = vedo.AnimationPlayer(
    frames,
    fps=10,
    loop=True,
    show_controls=True
)
player.show()

# 2D slice viewer
slice_viewer = vedo.Slicer2DPlotter(
    volume,
    size=(800, 600),
    bg="white"
)
slice_viewer.show()

Advanced Usage Patterns

# Combining applications with custom functionality
import vedo

# Create volume data
volume = vedo.load("medical_scan.nrrd")

# Custom slicer with additional features
class CustomSlicer(vedo.Slicer3DPlotter):
    def __init__(self, volume, **kwargs):
        super().__init__(volume, **kwargs)
        
        # Add custom measurement tools
        self.add_measurement_tools()
        
        # Add export functionality
        self.add_export_buttons()
    
    def add_measurement_tools(self):
        # Add distance measurement tools
        pass
    
    def add_export_buttons(self):
        # Add buttons for exporting slices
        pass

# Use custom slicer
custom_slicer = CustomSlicer(volume, show_histo=True)
custom_slicer.show()

# Chain multiple applications
def create_analysis_pipeline(volume):
    # First, browse isosurfaces to find interesting values
    iso_browser = vedo.IsosurfaceBrowser(volume)
    
    # Then use ray casting for detailed volume rendering
    ray_caster = vedo.RayCastPlotter(volume)
    
    # Finally, use 3D slicer for detailed examination
    slicer = vedo.Slicer3DPlotter(volume)
    
    return iso_browser, ray_caster, slicer

Install with Tessl CLI

npx tessl i tessl/pypi-vedo

docs

analysis-algorithms.md

applications.md

colors-visual.md

core-objects.md

file-io.md

index.md

plotting-visualization.md

shape-generation.md

transformations-geometry.md

ui-components.md

tile.json