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:
PyVista Readers# Reader
File Extension(s)
Return Type(s)
.inp.tri.bmp.g.cgns.dem.dcm,.img.case.e,.ex2,.exii,.exo.facet.h5.cas.frd.neu.cube.mr.gif.glb,.gltf.grdecl.hdf,.vtkhdfImageData,MultiBlock,PartitionedDataSet,PolyData,UnstructuredGrid.hdr.jpeg,.jpg.mha,.mhd.res.mnc.nek5000.nii,.nii.gz.nhdr,.nrrd.obj.raw.pdb.e.N.p,.n.N.p.p3d.ply.png.pnm.foam.vrt.pts.pvd.segy,.sgy.seriesExplicitStructuredGrid,ImageData,MultiBlock,PartitionedDataSet,PointSet,PolyData,RectilinearGrid,StructuredGrid,UnstructuredGrid.slc.stl.dat.3ds.tif,.tiff.vrml,.wrl.vtkImageData,PolyData,RectilinearGrid,StructuredGrid,UnstructuredGrid.pvtkImageData,PolyData,RectilinearGrid,StructuredGrid,UnstructuredGrid.xdmfMultiBlock,RectilinearGrid,StructuredGrid,UnstructuredGrid.vti.vtm,.vtmb.vtpd.pvti.vtp.pvtr.pvtu.vtr.vts.vtu- Parameters:
- Returns:
pyvista.BaseReaderA subclass of
pyvista.BaseReaderis returned based on file type.
Examples#
Download Python source code | Download Jupyter notebook
>>> import pyvista as pv
>>> from pyvista import examples
>>> from pathlib import Path
>>> filename = examples.download_human(load=False)
>>> Path(filename).name
'Human.vtp'
>>> reader = pv.get_reader(filename)
>>> reader
XMLPolyDataReader('...Human.vtp')
>>> mesh = reader.read()
>>> mesh
PolyData ...
>>> mesh.plot(color='lightblue')