General Utilities#

utilities.VtkErrorCatcher([raise_errors, ...])

Context manager to temporarily catch VTK errors.

utilities.axis_rotation(points, angle[, ...])

Rotate points by angle about an axis.

utilities.is_inside_bounds(point, bounds)

Check if a point is inside a set of bounds.

utilities.set_error_output_file(filename)

Set a file to write out the VTK errors.

Object Conversions or Wrapping#

array_from_vtkmatrix(matrix)

Convert a vtk matrix to an array.

cubemap([path, prefix, ext])

Construct a cubemap from 6 images from a directory.

cubemap_from_filenames(image_paths)

Construct a cubemap from 6 images.

image_to_texture(image)

Convert vtkImageData (pyvista.UniformGrid) to a vtkTexture.

is_pyvista_dataset(obj)

Return True if the object is a PyVista wrapped dataset.

numpy_to_texture(image)

Convert a NumPy image array to a vtk.vtkTexture.

pyvista_ndarray(array[, dataset, association])

An ndarray which references the owning dataset and the underlying vtkArray.

vtkmatrix_from_array(array)

Convert a numpy.ndarray or array-like to a vtk matrix.

wrap(dataset)

Wrap any given VTK data object to its appropriate PyVista data object.

File IO#

read(filename[, attrs, force_ext, ...])

Read any file type supported by vtk or meshio.

read_exodus(filename[, animate_mode_shapes, ...])

Read an ExodusII file ('.e' or '.exo').

read_legacy(filename[, progress_bar])

Use VTK's legacy reader to read a file.

read_texture(filename[, attrs, progress_bar])

Load a texture from an image file.

save_meshio(filename, mesh[, file_format])

Save mesh to file using meshio.

Mesh Creation#

CellType(value)

Define types of cells.

fit_plane_to_points(points[, return_meta])

Fit a plane to a set of points using the SVD algorithm.

lines_from_points(points[, close])

Make a connected line set given an array of points.

vector_poly_data(orig, vec)

Create a pyvista.PolyData object composed of vectors.

vtk_points(points[, deep, force_float])

Convert numpy array or array-like to a vtkPoints object.

Array Access#

cell_array(obj, name)

Return cell array of a pyvista or vtk object.

convert_array(arr[, name, deep, array_type])

Convert a NumPy array to a vtkDataArray or vice versa.

field_array(obj, name)

Return field data of a pyvista or vtk object.

get_array(mesh, name[, preference, err])

Search point, cell and field data for an array.

point_array(obj, name)

Return point array of a pyvista or vtk object.

Image Comparison and Regression#

compare_images(im1, im2[, threshold, use_vtk])

Compare two different images of the same size.

Miscellaneous#

Color([color, opacity, default_color, ...])

Helper class to convert between different color representations used in the pyvista library.

ColorLike

Any object convertible to a Color.

start_xvfb([wait, window_size])

Start the virtual framebuffer Xvfb.

Report([additional, ncol, text_width, sort, gpu])

Generate a PyVista software environment report.

VTK Version Information#

The PyVista library is heavily dependent on VTK and provides an easy way of getting the version of VTK in your environment.

Output the version of VTK.

>>> import pyvista
>>> pyvista.vtk_version_info
VTKVersionInfo(major=9, minor=1, micro=0)

Get the major version of VTK

>>> pyvista.vtk_version_info.major
9