volumes#


class EulerTransform(action: ManipulatorAction, origin: ndarray | None = None)[source]#
static get_angles_from_rotation_matrix(rotation_matrix: ndarray) ndarray[source]#

Get the angles from a rotation matrix.

get_transform_matrix() ndarray[source]#
class ImageVolume(volume: Image, *args: Any, optimal_action: ManipulatorAction | None = None)[source]#

Represents a 3D volume.

get_volume_slice(action: ManipulatorAction, slice_shape: tuple[int, int] | None = None) Image[source]#

Slice a 3D volume with arbitrary rotation and translation.

Parameters:
  • volume -- 3D volume to be sliced

  • action -- action to transform the volume

  • slice_shape -- shape of the output slice

Returns:

the sliced volume.

property optimal_action: ManipulatorAction#
class TransformedVolume(volume: ImageVolume, transformation_action: ManipulatorAction | None, *args: Any)[source]#

Represents a volume that has been transformed by an action.

property optimal_action: ManipulatorAction#
project_into_volume_bounds(transformed_action: ManipulatorAction) ManipulatorAction[source]#

Project the action to the positive octant. This is needed when transforming the optimal action accordingly to the random volume transformation. It might be, that for a negative translation and/or a negative z-rotation, the coordinates defining the optimal action land in negative space. Since the action defines a coordinate frame which infers a plane (x-z plane, y normal to the plane), assuming that this plane is still intercepting the positive octant, it is possible to redefine the action in positive coordinates by projecting it into the positive octant.

It needs to be tested, that the volume transformations keep the optimal action in a reachable space. Volume transformations are used for data augmentation only, so can be defined in the most convenient way.

transform_action(relative_action: ManipulatorAction) ManipulatorAction[source]#

Transform an action by the inverse of the volume transformation to be relative to the new coordinate system.

property transformation_action: ManipulatorAction#