pyvista.ImageData#
- class ImageData(*args, **kwargs)[source]#
Models datasets with uniform spacing in the three coordinate directions.
Can be initialized in one of several ways:
Create empty grid
Initialize from a vtkImageData object
Initialize based on dimensions, cell spacing, and origin.
Changed in version 0.33.0: First argument must now be either a path or vtkImageData. Use keyword arguments to specify the dimensions, spacing, and origin of the uniform grid.
Changed in version 0.37.0: The
dimsparameter has been renamed todimensions.- Parameters:
- uinput
str| vtkImageData |ImageData,optional Filename or dataset to initialize the uniform grid from. If set, remainder of arguments are ignored.
- dimensionssequence[
int],optional dimensionsof the uniform grid.- spacingsequence[
float], default: (1.0, 1.0, 1.0) spacingof the uniform grid in each dimension. Must be positive.- originsequence[
float], default: (0.0, 0.0, 0.0) originof the uniform grid.- deepbool, default:
False Whether to deep copy a vtkImageData object. Keyword only.
- direction_matrix
RotationLike,optional The
direction_matrixis a 3x3 matrix which controls the orientation of the image data.Added in version 0.45.
- offset
int|VectorLike[int], default: (0, 0, 0) The offset defines the minimum
extentof the image. Offset values can be positive or negative. In physical space, the offset is relative to the image’sorigin.Added in version 0.45.
- uinput
See also
Examples
Create an empty ImageData.
>>> import pyvista as pv >>> grid = pv.ImageData()
Initialize from a vtkImageData object.
>>> import vtk >>> vtkgrid = vtk.vtkImageData() >>> grid = pv.ImageData(vtkgrid)
Initialize using just the grid dimensions and default spacing and origin. These must be keyword arguments.
>>> grid = pv.ImageData(dimensions=(10, 10, 10))
Initialize using dimensions and spacing.
>>> grid = pv.ImageData( ... dimensions=(10, 10, 10), ... spacing=(2, 1, 5), ... )
Initialize using dimensions, spacing, and an origin.
>>> grid = pv.ImageData( ... dimensions=(10, 10, 10), ... spacing=(2, 1, 5), ... origin=(10, 35, 50), ... )
Initialize from another ImageData.
>>> grid = pv.ImageData( ... dimensions=(10, 10, 10), ... spacing=(2, 1, 5), ... origin=(10, 35, 50), ... ) >>> grid_from_grid = pv.ImageData(grid) >>> grid_from_grid == grid True
Methods#
Cast this uniform grid to a rectilinear grid. |
|
Cast this uniform grid to a structured grid. |
|
|
Create a tetrahedral mesh structured grid. |
Attributes#
Return the active normals as an array. |
|
Return the active scalars as an array. |
|
Return the active scalar's association and name. |
|
Return the name of the active scalars. |
|
Return the active tensors array. |
|
Return the active tensor's field and name: [field, name]. |
|
Return the name of the active tensor array. |
|
Return the active texture coordinates on the points. |
|
Return the active vectors array. |
|
Return the active vector's association and name. |
|
Return the name of the active vectors array. |
|
Return the actual size of the dataset object. |
|
Return the mesh area if 2D. |
|
Return a list of array names for the dataset. |
|
Return a glyph representation of the active vector data as arrows. |
|
Return the bounding box of this dataset. |
|
Return the size of each axis of the object's bounding box. |
|
A generator that provides an easy way to loop over all cells. |
|
Return cell data as DataSetAttributes. |
|
read-only, Calls GetCellGhostArray |
|
read-only, Calls GetCellTypesArray |
|
read-only, Calls GetCells |
|
Return the center of the bounding box. |
|
read-only, Calls GetClassName |
|
read-only, Calls GetDataDescription |
|
read-only, Calls GetDataDimension |
|
read-only, Calls GetDataObjectType |
|
read-only, Calls GetDataReleased |
|
read-write, Calls GetDebug/SetDebug |
|
Return the dimensionality of the grid. |
|
Return the grid's dimensions. |
|
Set or get the direction matrix. |
|
Return or set the extent of the ImageData. |
|
read-only, Calls GetExtentType |
|
Return FieldData as DataSetAttributes. |
|
read-write, Calls GetGlobalReleaseDataFlag/SetGlobalReleaseDataFlag |
|
read-write, Calls GetGlobalWarningDisplay/SetGlobalWarningDisplay |
|
read-only, Calls GetIncrements |
|
Return or set 4x4 matrix to transform index space (ijk) to physical space (xyz). |
|
read-write, Calls GetInformation/SetInformation |
|
Return |
|
read-only, Calls GetIsInMemkind |
|
Return the length of the diagonal of the bounding box. |
|
read-only, Calls GetLength2 |
|
read-only, Calls GetMTime |
|
read-only, Calls GetMaxCellSize |
|
read-only, Calls GetMaxSpatialDimension |
|
write-only, Calls SetMemkindDirectory |
|
Get address of the underlying VTK C++ object. |
|
read-only, Calls GetMeshMTime |
|
read-only, Calls GetMinSpatialDimension |
|
Return the number of arrays present in the dataset. |
|
Return the number of cells in the entire dataset. |
|
Return the number of points in the entire dataset. |
|
Return the number of cells. |
|
Return the number of points. |
|
read-only, Calls GetNumberOfScalarComponents |
|
read-only, Calls GetObjectDescription |
|
read-write, Calls GetObjectName/SetObjectName |
|
Return or set the index offset of the ImageData. |
|
Return the origin of the grid (bottom southwest corner). |
|
Return or set 4x4 matrix to transform from physical space (xyz) to index space (ijk). |
|
Return point data as DataSetAttributes. |
|
read-only, Calls GetPointGhostArray |
|
Build a copy of the implicitly defined points as a numpy array. |
|
read-write, Calls GetReferenceCount/SetReferenceCount |
|
read-only, Calls GetScalarPointer |
|
read-only, Calls GetScalarRange |
|
read-only, Calls GetScalarSize |
|
read-only, Calls GetScalarType |
|
read-only, Calls GetScalarTypeMax |
|
read-only, Calls GetScalarTypeMin |
|
Return or set the spacing for each axial direction. |
|
read-only, Calls GetUpdateTime |
|
Set or return a user-specified data dictionary. |
|
read-only, Calls GetUsingMemkind |
|
Return the mesh volume. |
|
Return all the X points. |
|
Return all the Y points. |
|
Return all the Z points. |