MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / convert_points_to_box

Function convert_points_to_box

monai/transforms/spatial/functional.py:708–723  ·  view source on GitHub ↗

Converts points to an axis-aligned bounding box. Args: points: Points representing the corners of the bounding box. Shape (N, 8, 3) for the 8 corners of a 3D cuboid or (N, 4, 2) for the 4 corners of a 2D rectangle.

(points)

Source from the content-addressed store, hash-verified

706
707
708def convert_points_to_box(points):
709 """
710 Converts points to an axis-aligned bounding box.
711
712 Args:
713 points: Points representing the corners of the bounding box. Shape (N, 8, 3) for the 8 corners of
714 a 3D cuboid or (N, 4, 2) for the 4 corners of a 2D rectangle.
715 """
716 from monai.transforms.utils_pytorch_numpy_unification import max, min
717
718 mins = min(points, dim=1)
719 maxs = max(points, dim=1)
720 # Concatenate the min and max values to get the bounding boxes
721 bboxes = concatenate([mins, maxs], axis=1)
722
723 return bboxes

Callers 1

__call__Method · 0.90

Calls 3

minFunction · 0.90
maxFunction · 0.90
concatenateFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…