pyvista.get_reader#

get_reader(filename, force_ext=None)[source]#

Get a reader for fine-grained control of reading data files.

Supported file types and Readers:

File Extension

Class

.bmp

pyvista.BMPReader

.cas

pyvista.FluentReader

.case

pyvista.EnSightReader

.cgns

pyvista.CGNSReader

.cube

pyvista.GaussianCubeReader

.dat

pyvista.TecplotReader

.dcm

pyvista.DICOMReader

.dem

pyvista.DEMReader

.facet

pyvista.FacetReader

.foam

pyvista.POpenFOAMReader

.g

pyvista.BYUReader

.gif

pyvista.GIFReader

.glb

pyvista.GLTFReader

.gltf

pyvista.GLTFReader

.hdf

pyvista.HDFReader

.img

pyvista.DICOMReader

.inp

pyvista.AVSucdReader

.jpg

pyvista.JPEGReader

.jpeg

pyvista.JPEGReader

.hdr

pyvista.HDRReader

.mha

pyvista.MetaImageReader

.mhd

pyvista.MetaImageReader

.nii

pyvista.NIFTIReader

.nii.gz

pyvista.NIFTIReader

.nhdr

pyvista.NRRDReader

.nrrd

pyvista.NRRDReader

.obj

pyvista.OBJReader

.p3d

pyvista.Plot3DMetaReader

.ply

pyvista.PLYReader

.png

pyvista.PNGReader

.pnm

pyvista.PNMReader

.pts

pyvista.PTSReader

.pvd

pyvista.PVDReader

.pvti

pyvista.XMLPImageDataReader

.pvtk

pyvista.VTKPDataSetReader

.pvtr

pyvista.XMLPRectilinearGridReader

.pvtu

pyvista.XMLPUnstructuredGridReader

.res

pyvista.MFIXReader

.segy

pyvista.SegYReader

.sgy

pyvista.SegYReader

.slc

pyvista.SLCReader

.stl

pyvista.STLReader

.tif

pyvista.TIFFReader

.tiff

pyvista.TIFFReader

.tri

pyvista.BinaryMarchingCubesReader

.vrt

pyvista.ProStarReader

.vti

pyvista.XMLImageDataReader

.vtk

pyvista.VTKDataSetReader

.vtm

pyvista.XMLMultiBlockDataReader

.vtmb

pyvista.XMLMultiBlockDataReader

.vtp

pyvista.XMLPolyDataReader

.vtr

pyvista.XMLRectilinearGridReader

.vts

pyvista.XMLStructuredGridReader

.vtu

pyvista.XMLUnstructuredGridReader

.xdmf

pyvista.XdmfReader

.vtpd

pyvista.XMLPartitionedDataSetReader

Parameters:
filenamestr, Path

The string path to the file to read.

force_extstr, optional

An extension to force a specific reader to be chosen.

Returns:
pyvista.BaseReader

A subclass of pyvista.BaseReader is returned based on file type.

Examples

>>> import pyvista as pv
>>> from pyvista import examples
>>> filename = examples.download_human(load=False)
>>> filename.split("/")[-1]  # omit the path
'Human.vtp'
>>> reader = pv.get_reader(filename)
>>> reader
XMLPolyDataReader('.../Human.vtp')
>>> mesh = reader.read()
>>> mesh
PolyData ...
>>> mesh.plot(color='lightblue')
../../../_images/pyvista-get_reader-1_00_00.png