webknossos.geometry.bounding_box
This class is used to represent an axis-aligned cuboid in 3D. The top-left coordinate is inclusive and the bottom-right coordinate is exclusive.
A small usage example:
from webknossos import BoundingBox
bbox_1 = BoundingBox((0, 0, 0), (100, 100, 100))
bbox_2 = BoundingBox((75, 75, 75), (100, 100, 100))
assert bbox_1.intersected_with(bbox_2).size == (25, 25, 25)
Method generated by attrs for class BoundingBox.
Returns a copy of the bounding box with topleft.x optionally replaced and size.x optionally replaced.
Returns a copy of the bounding box with topleft.y optionally replaced and size.y optionally replaced.
Returns a copy of the bounding box with topleft.z optionally replaced and size.z optionally replaced.
Returns a bounding box exactly containing all points.
This function extracts a bounding box in the format x_y_z_sx_sy_xz
which is contained in a string.
Groups the given BoundingBox instances by aligning each bbox to the given mag and using that as the key. For example, bounding boxes of size 2563 could be grouped into the corresponding 10243 chunks to which they belong by using aligning_mag = Mag(1024).
If dont_assert is set to False, this method may return empty bounding boxes (size == (0, 0, 0))
Rounds the bounding box, so that both topleft and bottomright are divisible by mag.
:argument ceil: If true, the bounding box is enlarged when necessary. If false, it's shrinked when necessary.
Check whether a point is inside of the bounding box. Note that the point may have float coordinates in the ndarray case
Decompose the bounding box into smaller chunks of size chunk_shape
.
Chunks at the border of the bounding box might be smaller than chunk_shape.
If chunk_border_alignment
is set, all border coordinates
between two chunks will be divisible by that value.