pyvista.ImageData.offset

Contents

pyvista.ImageData.offset#

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

Return or set the index offset of the ImageData.

The offset is simply the first indices for each of the three axes and defines the minimum extent of the image. Offset values can be positive or negative. In physical space, the offset is relative to the image’s origin.

Added in version 0.45.

Examples

Create a ImageData and show that the offset is zeros by default.

>>> import pyvista as pv
>>> grid = pv.ImageData(dimensions=(10, 10, 10))
>>> grid.offset
(0, 0, 0)

The offset defines the minimum extent. >>> grid.extent (0, 9, 0, 9, 0, 9)

Set the offset to a new value for all axes.

>>> grid.offset = 2
>>> grid.offset
(2, 2, 2)

Show the extent again. Note how all values have increased by the offset value.

>>> grid.extent
(2, 11, 2, 11, 2, 11)

Set the offset for each axis separately and show the extent again.

>>> grid.offset = (-1, -2, -3)
>>> grid.extent
(-1, 8, -2, 7, -3, 6)