BaseRegionOfInterest#

class movement.roi.base.BaseRegionOfInterest(points, dimensions=2, closed=False, holes=None, name=None)[source]#

Bases: object

Base class for representing regions of interest (RoIs).

Regions of interest can be either 1 or 2 dimensional, and are represented by appropriate shapely.Geometry objects depending on which. Note that there are a number of discussions concerning subclassing shapely objects;

To avoid the complexities of subclassing ourselves, we simply elect to wrap the appropriate shapely object in the _shapely_geometry attribute, accessible via the property region. This also has the benefit of allowing us to ‘forbid’ certain operations (that shapely would otherwise interpret in a set-theoretic sense, giving confusing answers to users).

This class is not designed to be instantiated directly. It can be instantiated, however its primary purpose is to reduce code duplication.

property coords: CoordinateSequence#

Coordinates of the points that define the region.

These are the points passed to the constructor argument points.

Note that for Polygonal regions, these are the coordinates of the exterior boundary, interior boundaries must be accessed via self.region.interior.coords.

property dimensions: int#

Dimensionality of the region.

property is_closed: bool#

Return True if the region is closed.

A closed region is either: - A polygon (2D RoI). - A 1D LoI whose final point connects back to its first.

property name: str#

Name of the instance.

property region: LinearRing | LineString | Polygon#

shapely.Geometry representation of the region.