tomosipo.geometry.VolumeGeometry

class tomosipo.geometry.VolumeGeometry(shape=(1, 1, 1), pos=0, size=None)[source]

A volume geometry

A VolumeGeometry describes a 3D axis-aligned cuboid that is divided into voxels.

The number of voxels in each dimension determine the object’s shape. The voxel size is thus determined by the size of the object and its shape.

A VolumeGeometry cannot move in time and cannot be arbitrarily oriented. To obtain a moving volume geometry, convert the object to a vector representation using .to_vec().

__init__(shape=(1, 1, 1), pos=0, size=None)[source]

Create an axis-aligned volume geometry

A VolumeGeometry is an axis-aligned cuboid centered on pos.

You may provide a combination of arguments to create a new volume geometry:

  • shape (size will equal shape)

  • shape and pos (size will equal shape)

  • shape and size (volume will be centered on the origin)

  • shape, pos, and size.

Parameters:
  • shape – Shape of the voxel grid underlying the volume.

  • pos – Position of the center of the volume. By default, the volume is placed on the origin.

  • size – The size of the volume in physical units. This determines the shape. If not provided, the size will equal the shape.

  • extent – The minimal and maximal value of the volume in the (z, y, x) coordinate space. If only one minimal and maximal value is provided, then it is applied to all coordinates.

Methods

__init__([shape, pos, size])

Create an axis-aligned volume geometry

multiply(scale)

Scales the volume including its position.

reshape(new_shape)

Reshape the VolumeGeometry

scale(scale)

Scales the volume around its center.

to_astra()

Return an Astra volume geometry.

to_vec()

Returns a vector representation of the volume

translate(t)

untranslate(ts)

with_voxel_size(voxel_size)

Returns a new volume with the specified voxel size

Attributes

corners

Returns a vector with the corners of the volume

extent

The extent of the volume in each dimension

lower_left_corner

Returns a vector with the positions of the lower-left corner the object

num_steps

The number of orientations and positions of this volume

pos

shape

size

Returns the absolute size of the volume

sizes

Returns the absolute sizes of the volume

u

v

voxel_size

The voxel size of the volume

voxel_sizes

The voxel sizes of the volume

w