MSImagingRegion#

class pyopenms.MSImagingRegion#

Bases: object

Region handling class that provides membership checks and region local indexing. Regions are either Rectangle based and defined by their x/y minima and maxima or bitmasked with a bounding box for irregular shapes.

__init__() → None#
__init__(arg: pyopenms.MSImagingRegion, /) → None

Methods

__init__()

area()

contains(x, y)

fromMask(id, name, origin_x, origin_y, ...)

Overloaded function.

getBBoxHeight()

getBBoxWidth()

getId()

getMaxX()

getMaxY()

getMinX()

getMinY()

getName()

getShape()

get_mask()

Returns a 2D uint8 numpy array (bbox_h, bbox_w); 1 = inside region.

intersects(other)

rectangle(id, name, min_x, min_y, max_x, max_y)

class Shape(*values)#

Bases: Enum

Mask = 1#
Rectangle = 0#
getMapping()#

Returns a dict mapping int values to enum member name strings.

area() → int#
contains(x: int, y: int) → bool#
static fromMask(id: int, name: str, origin_x: int, origin_y: int, width: int, height: int, mask: collections.abc.Sequence[bool]) → pyopenms.MSImagingRegion#
static fromMask(id: int, name: str, origin_x: int, origin_y: int, width: int, height: int, mask: ndarray[dtype=bool, shape=(*), order='C']) → pyopenms.MSImagingRegion
static fromMask(id: int, name: str, origin_x: int, origin_y: int, mask: ndarray[dtype=bool, shape=(*, *), order='C']) → pyopenms.MSImagingRegion

Overloaded function.

  1. fromMask(id: int, name: str, origin_x: int, origin_y: int, width: int, height: int, mask: collections.abc.Sequence[bool]) -> pyopenms.MSImagingRegion

  2. fromMask(id: int, name: str, origin_x: int, origin_y: int, width: int, height: int, mask: ndarray[dtype=bool, shape=(*), order='C']) -> pyopenms.MSImagingRegion

Create a region from a 1D boolean mask array (row-major, size = width * height).

  1. fromMask(id: int, name: str, origin_x: int, origin_y: int, mask: ndarray[dtype=bool, shape=(*, *), order='C']) -> pyopenms.MSImagingRegion

Create a region from a 2D (height, width) boolean numpy array; width/height are taken from the shape.

getBBoxHeight() → int#
getBBoxWidth() → int#
getId() → int#
getMaxX() → int#
getMaxY() → int#
getMinX() → int#
getMinY() → int#
getName() → str#
getShape() → pyopenms.MSImagingRegion.Shape#
get_mask() → numpy.ndarray[dtype=uint8, shape=(*, *)]#

Returns a 2D uint8 numpy array (bbox_h, bbox_w); 1 = inside region.

intersects(other: pyopenms.MSImagingRegion) → bool#
static rectangle(id: int, name: str, min_x: int, min_y: int, max_x: int, max_y: int) → pyopenms.MSImagingRegion#