siibra.locations.boundingbox

A box defined by two farthest corner coordinates on a specific space.

Module Contents

Classes

BoundingBox

A 3D axis-aligned bounding box spanned by two 3D corner points.

Functions

from_array(→ BoundingBox)

Find the bounding box of an array.

class siibra.locations.boundingbox.BoundingBox(point1, point2, space: str | siibra.core.space.Space = None, minsize: float = None, sigma_mm=None)
Inheritance diagram of siibra.locations.boundingbox.BoundingBox

A 3D axis-aligned bounding box spanned by two 3D corner points. The box does not necessarily store the given points, instead it computes the real minimum and maximum points from the two corner points.

property center: siibra.locations.point.Point
property id: str
property is_planar: bool
property shape: float

The distances of the diagonal points in each axis. (Accounts for sigma).

property volume: float

The volume of the boundingbox in mm^3

__eq__(other: BoundingBox)

Required to provide comparison and making the object hashable

__hash__()

Return hash(self).

__iter__()

Iterate the min- and maxpoint of this bounding box.

__str__()

Return str(self).

clip(xyzmax, xyzmin=(0, 0, 0))

Returns a new bounding box obtained by clipping at the given maximum coordinate.

estimate_affine(space)

Computes an affine transform which approximates the nonlinear warping of the eight corner points to the desired target space. The transform is estimated using a least squares solution to A*x = b, where A is the matrix of point coefficients in the space of this bounding box, and b are the target coefficients in the given space after calling the nonlinear warping.

intersection(other: siibra.core.structure.BrainStructure, dims=[0, 1, 2])

Computes the intersection of this bounding box with another one.

Parameters:
  • other (BrainStructure) –

  • dims (List[int], default: all three) – Dimensions where the intersection should be computed (applies only to bounding boxes). Along dimensions not listed, the union is applied instead.

shift(offset)
transform(affine: numpy.ndarray, space=None)

Returns a new bounding box obtained by transforming the min- and maxpoint of this one with the given affine matrix.

TODO process the sigma values o the points

Parameters:
  • affine (numpy 4x4 ndarray) – affine matrix

  • space (reference space (str, Space, or None)) – Target reference space which is reached after applying the transform. Note that the consistency of this cannot be checked and is up to the user.

warp(space)

Returns a new bounding box obtained by warping the min- and maxpoint of this one into the new target space.

TODO process the sigma values o the points

zoom(ratio: float)

Create a new bounding box by zooming this one around its center.

siibra.locations.boundingbox.from_array(array: numpy.ndarray, threshold=0, space: siibra.core.space.Space = None) BoundingBox

Find the bounding box of an array.

Parameters:
  • array (np.ndarray) –

  • threshold (int, default: 0) –

  • space (Space, default: None) –