locan.data.region.Region3D#

class locan.data.region.Region3D[source]#

Bases: Region

Abstract Region class to define the interface for 3-dimensional Region classes.

Methods

__init__()

as_artist([origin])

Matplotlib patch object for this region (e.g. matplotlib.patches.Ellipse).

buffer(distance, **kwargs)

Extend the region perpendicular by a distance.

contains(points)

Return list of indices for all points that are inside the region of interest.

from_intervals(intervals)

Constructor for instantiating axis-oriented, box-like Region from list of (min, max) bounds.

intersection(other)

Returns a region representing the intersection of this region with other.

plot([ax])

Provide plot of region as matplotlib.axes.Axes object.

symmetric_difference(other)

Returns the union of the two regions minus any areas contained in the intersection of the two regions.

union(other)

Returns a region representing the union of this region with other.

Attributes

bounding_box

A region describing the minimum axis-aligned bounding box that encloses the original region.

bounds

Region bounds min_x, min_y, ..., max_x, max_y, .

centroid

Point coordinates for region centroid.

dimension

The region dimension.

extent

The extent (max_x - min_x), (max_y - min_y), .

max_distance

The maximum distance between any two points within the region.

points

Point coordinates.

region_measure

Region measure, i.e. area (for 2d) or volume (for 3d).

subregion_measure

Measure of the sub-dimensional region, i.e. circumference (for 2d) or surface (for 3d).

abstract as_artist(origin=(0, 0, 0), **kwargs)[source]#

Matplotlib patch object for this region (e.g. matplotlib.patches.Ellipse).

Parameters:
  • origin (Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) – The (x, y, z) pixel position of the origin of the displayed image. Default is (0, 0, 0).

  • kwargs (Any) – Other parameters passed to the matplotlib.patches object.

Returns:

Matplotlib patch for the specified region.

Return type:

matplotlib.patches.Patch

property dimension: int#

The region dimension.

Return type:

int | None

intersection(other)[source]#

Returns a region representing the intersection of this region with other.

Parameters:

other (Region) – Other region

Return type:

Region

plot(ax=None, **kwargs)[source]#

Provide plot of region as matplotlib.axes.Axes object.

Parameters:
  • ax (Optional[Axes]) – The axes on which to show the image

  • kwargs (Any) – Other parameters passed to the matplotlib.patches object.

Returns:

Axes object with the plot.

Return type:

matplotlib.axes.Axes

symmetric_difference(other)[source]#

Returns the union of the two regions minus any areas contained in the intersection of the two regions.

Parameters:

other (Region) – Other region

Return type:

Region

union(other)[source]#

Returns a region representing the union of this region with other.

Parameters:

other (Region) – Other region

Return type:

Region