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.
Create an instance of NDBoundingBox from a dictionary representation.
Args:
- bbox (Dict): The dictionary representation of the bounding box.
Returns:
- NDBoundingBox: An instance of NDBoundingBox.
Raises:
- AssertionError: If additionalAxes are present but axisOrder is not provided.
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.
Converts the bounding box object to a json dictionary.
Returns:
- dict: A json dictionary representing the bounding box.
Returns a dictionary representation of the bounding box.
Returns:
- dict: A dictionary representation of the bounding box.
Returns a string representation of the bounding box that can be used as a checkpoint name.
Returns:
- str: A string representation of the bounding box.
Boolean check whether the boundung box is empty.
Returns:
- bool: True if the bounding box is empty, False otherwise.
Returns the bounding box in the given mag.
Args:
- mag (Mag): The magnification to convert the bounding box to.
Returns:
- NDBoundingBox: The bounding box in the given magnification.
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.
Returns a new NDBoundingBox object with the specified offset.
Args:
- vector (VecIntLike): The offset to apply to the bounding box.
Returns:
- NDBoundingBox: A new NDBoundingBox object with the specified offset.
Inherited Members
- webknossos.geometry.nd_bounding_box.NDBoundingBox
- with_name
- with_topleft
- with_size
- with_index
- with_bottomright
- with_is_visible
- with_color
- with_bounds
- get_bounds
- group_boxes_with_aligned_mag
- get_shape
- topleft_xyz
- size_xyz
- bottomright_xyz
- index_xyz
- with_topleft_xyz
- with_size_xyz
- with_bottomright_xyz
- with_index_xyz
- intersected_with
- extended_by
- from_mag_to_mag1
- contains_bbox
- volume
- slice_array
- to_slices