pyvista.ImageData.offset

pyvista.ImageData.offset#

property ImageData.offset: tuple[int, int, int][ソース]#

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.

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)