General Utilities#

core.utilities.VtkErrorCatcher([...])

Context manager to temporarily catch VTK errors.

core.utilities.axis_rotation(points, angle)

Rotate points by angle about an axis.

core.utilities.is_inside_bounds(point, bounds)

Check if a point is inside a set of bounds.

core.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 pyvista.ImageData to a pyvista.Texture.

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 pyvista.Texture.

pyvista_ndarray(array[, dataset, association])

A 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.

Features#

cartesian_to_spherical(x, y, z)

Convert 3D Cartesian coordinates to spherical coordinates.

create_grid(dataset[, dimensions])

Create a uniform grid surrounding the given dataset.

grid_from_sph_coords(theta, phi, r)

Create a structured grid from arrays of spherical coordinates.

merge(datasets[, merge_points, ...])

Merge several datasets.

perlin_noise(amplitude, freq, phase)

Return the implicit function that implements Perlin noise.

sample_function(function[, bounds, dim, ...])

Sample an implicit function over a structured point set.

spherical_to_cartesian(r, phi, theta)

Convert Spherical coordinates to 3D Cartesian coordinates.

transform_vectors_sph_to_cart(theta, phi, r, ...)

Transform vectors from spherical (r, phi, theta) to cartesian coordinates (z, y, x).

voxelize(mesh[, density, check_surface])

Voxelize mesh to UnstructuredGrid.

voxelize_volume(mesh[, density, check_surface])

Voxelize mesh to create a RectilinearGrid voxel volume.

File IO#

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

Read any file type supported by vtk or meshio.

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

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

read_texture(filename[, 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[, names, module, qualname, ...])

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.

PyVista Version Information#

The PyVista library provides a way of getting the version installed in your environment.

Output the version of PyVista.

>>> import pyvista
>>> pyvista.version_info
(0, 44, 0)

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