siibra.locations.boundingbox

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

Classes

BoundingBox

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

Module Contents

class siibra.locations.boundingbox.BoundingBox(point1, point2, 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.

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

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

contained_in(other: siibra.locations.location.Location | nibabel.Nifti1Image)
contains(other: siibra.locations.location.Location)

Returns true if the bounding box contains the given location.

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.

fetch_regional_map()

Generate a volumetric binary mask of this bounding box in the reference template space.

classmethod from_image(image: nibabel.Nifti1Image, space, ignore_affine=False, threshold=0)

Construct a bounding box from a nifti image

intersection(other, dims=[0, 1, 2], threshold=0)

Computes the intersection of this bounding box with another one.

TODO process the sigma values o the points

Args:

other (BoundingBox): Another bounding box dims (list of int): Dimensions where the intersection should be computed (applies only to bounding boxes) Default: all three. Along dimensions not listed, the union is applied instead. threshold: optional intensity threshold for intersecting with image mask

intersects(other: siibra.locations.location.Location | nibabel.Nifti1Image)

Verifies wether this 3D location intersects the given mask.

NOTE: The affine matrix of the image must be set to warp voxels coordinates into the reference space of this Bounding Box.

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.

union(other)

Computes the union of this boudning box with another one.

Args:

other (BoundingBox): Another bounding box

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.

property center
property id: str
property is_planar
maxpoint
minpoint
property shape
property volume