pyvista.ImageData.extent

Contents

pyvista.ImageData.extent#

property ImageData.extent: tuple[int, int, int, int, int, int][source]#

Return or set the extent of the ImageData.

The extent is simply the first and last indices for each of the three axes. It encodes information about the image’s offset and dimensions.

Examples

Create a ImageData and show its extent.

>>> import pyvista as pv
>>> grid = pv.ImageData(dimensions=(10, 10, 10))
>>> grid.extent
(0, 9, 0, 9, 0, 9)
>>> grid.extent = (2, 5, 2, 5, 2, 5)
>>> grid.extent
(2, 5, 2, 5, 2, 5)

Note how this also modifies the grid’s offset, dimensions, and bounds. Since we use default spacing of 1 here, the bounds match the extent exactly.

>>> grid.offset
(2, 2, 2)
>>> grid.dimensions
(4, 4, 4)
>>> grid.bounds
BoundsTuple(x_min=2.0, x_max=5.0, y_min=2.0, y_max=5.0, z_min=2.0, z_max=5.0)