neuron_morphology.snap_polygons.bounding_box
¶
Contains a simple utility for representing a “growable” 2D rectangle
Module Contents¶
Classes¶
BoundingBox |
Represents the bounds of a set of 2D objects |
-
class
neuron_morphology.snap_polygons.bounding_box.
BoundingBox
(horigin: float, vorigin: float, hextent: float, vextent: float)¶ Represents the bounds of a set of 2D objects
Parameters: - vorigin, horigin : the near corner of the box
- vextent, hextent : the far corner of the box
-
__slots__
= ['vorigin', 'horigin', 'vextent', 'hextent']¶
-
width
:float¶ Horizontal side length of the box.
-
height
:float¶ Vertical side length of the box.
-
aspect_ratio
:float¶ Width / height ratio of the box.
-
origin
¶ Coordinates of the box’s origin.
-
extent
¶ Coordinates of the box’s extent (opposite corner from the origin).
-
coordinates
¶ Origin and extent coordinates.
-
__repr__
(self)¶ Return repr(self).
-
update
(self, horigin: float, vorigin: float, hextent: float, vextent: float)¶ Potentially enlarges this box.
Parameters: - As to the constructor of BoundingBox. The new shape of this box is the
smallest box enclosing both this and the inputs.
-
transform
(self, transform: TransformType, inplace: bool = False)¶ Apply a transform to this box
Parameters: - transform : A callable which maps (vertical, horizontal) coordinates to
new (vertical, horizontal) coordinates.
- inplace : if True, apply the transform to this object
Returns: - The transformed box (potentially self)
-
copy
(self)¶ Duplicates this bounding box
Returns: - A copy of this object.
-
round
(self, inplace: bool = False, origin_via: Callable[[float], float] = np.around, extent_via: Callable[[float], float] = np.around)¶ Round the coordinates of this box
Parameters: - inplace : If True, round the coordinates of this object
- origin_via : method to use when rounding the origin
- extent_via : method to use when rounding the extent
Returns: - The rounded box (potentially self.