Submodule to load/write meshes and other objects in different formats, and other I/O functionalities.


class'movie.mp4', duration=None, fps=24, backend='ffmpeg')[source]

Bases: object

Class to generate a video from the specified rendering window. Program ffmpeg is used to create video from each generated frame. :param str name: name of the output file. :param int fps: set the number of frames per second. :param float duration: set the total duration of the video and recalculates fps accordingly. :param str ffmpeg: set path to ffmpeg program. Default value considers ffmpeg is in the path.

action(elevation_range=0, 80, azimuth_range=0, 359, zoom=None, cam1=None, cam2=None)[source]

Automatic shooting of the video with rotation and elevation ranges.

  • elevation_range (list) – initial and final elevation angles

  • azimuth_range (list) – initial and final azimuth angles

  • zoom (float) – initial zooming

  • cam12 – initial and final camera position, can be dictionary or a vtkCamera


Add frame to current video.


Render the video and write to file.


Insert a pause, in seconds.

download, force=False, verbose=True)[source]

Retrieve a file from a url, save it locally and return its path.

exportWindow, binary=False)[source]

Exporter which writes out the renderered scene into an HTML, X3D or Numpy file.

generated webpage

See also: FEniCS test webpage.


the rendering window can also be exported to numpy file scene.npz by pressing E keyboard at any moment during visualization.


Unzip a .gz file to a temporary file and returns its path.

importWindow, mtlFile=None, texturePath=None)[source]

Import a whole scene from a Numpy or OBJ wavefront file. Return a Plotter instance.

  • mtlFile (str) – MTL file for OBJ wavefront files.

  • texturePath (str) – path of the texture files directory.

load, unpack=True, force=False)[source]

Load Mesh, Volume and Picture objects from file or from the web.

The output will depend on the file extension. See examples below. Unzip on the fly, if it ends with .gz. Can load an object directly from a URL address.

  • unpack (bool) – unpack MultiBlockData into a flat list of objects.

  • force (bool) – when downloading a file ignore any previous cached downloads and force a new one.

from vedo import datadir, load, show

# Return a Mesh object
g = load(datadir+'250.vtk')

# Return a list of 2 meshes
g = load([datadir+'250.vtk', datadir+'270.vtk'])

# Return a list of meshes by reading all files in a directory
# (if directory contains DICOM files then a Volume is returned)
g = load('mydicomdir/')

# Return a Volume. Color/Opacity transfer functions can be specified later.
g = load(datadir+'embryo.slc')
g.c(['y','lb','w']).alpha((0.0, 0.4, 0.9, 1)).show()

# Download a file from a URL address and unzip it on the fly
g = load('')


Load a vtkRectilinearGrid object from file.


Load a vtkStructuredGrid object from file.


Load a vtkStructuredPoints object from file.


Load a vtkunStructuredGrid object from file.


Read a vtkTransform from a file.mat.


  • T (vtkTransform) – The transformation to be applied to some object (use applyTransform()).

  • comment (str) – a comment string associated to this transformation file.

screenshot'screenshot.png', scale=None, returnNumpy=False)[source]

Save a screenshot of the current rendering window.

  • scale (int) – set image magnification

  • returnNumpy (bool) – return a numpy array of the image

write, fileoutput, binary=True)[source]

Write 3D object to file. (same as save()).

Possile extensions are:
  • vtk, vti, npy, npz, ply, obj, stl, byu, vtp, vti, mhd, xyz, tif, png, bmp.

writeTransform, filename='transform.mat', comment='')[source]

Save a transformation for a mesh or pointcloud to ASCII file.

  • filename (str, optional) – output file name. The default is ‘transform.mat’.

  • comment (str, optional) – some optional comment. The default is ‘’.


Return type