8.5.5.2.4. pymodaq_gui.plotting.items.roi module

class pymodaq_gui.plotting.items.roi.CircularROI(index=0, pos=[0, 0], size=[10, 10], **kwargs)[source]

Bases: EllipseROI

DESCRIPTOR: str = 'CircularROI'
DIMENSIONALITY: DataDim = 'Data2D'
class pymodaq_gui.plotting.items.roi.DataDim(*values)[source]

Bases: StrEnum

Data1D = 'Data1D'
Data2D = 'Data2D'
class pymodaq_gui.plotting.items.roi.EllipseROI(index=0, pos=[0, 0], size=[10, 10], **kwargs)[source]

Bases: ROI

Elliptical ROI subclass with one scale handle and one rotation handle.

Arguments

pos

(length-2 sequence) The position of the ROI’s origin.

size

(length-2 sequence) The size of the ROI’s bounding rectangle.

**args

All extra keyword arguments are passed to ROI()

Methods

getArrayRegion(arr[, img, axes])

Return the result of ROI.getArrayRegion() masked by the elliptical shape of the ROI.

paint(self, painter, option[, widget])

shape()

getArrayRegion(arr, img=None, axes=(0, 1), **kwds)[source]

Return the result of ROI.getArrayRegion() masked by the elliptical shape of the ROI. Regions outside the ellipse are set to 0.

paint(self, painter: QPainter | None, option: QStyleOptionGraphicsItem | None, widget: QWidget | None = None)[source]
shape()[source]
DESCRIPTOR: str = 'EllipseROI'
DIMENSIONALITY: DataDim = 'Data2D'
class pymodaq_gui.plotting.items.roi.LinearROI(index=0, pos=[0, 10], name='roi', compute=True, **kwargs)[source]

Bases: LinearRegionItem, ROIMixin, ROIBase

Attributes:
color

Methods

contextMenuEvent(self, event)

pos()

setPos(pos)

center

contextMenuEnabled

copy_clipboard

getMenu

mouseClickEvent

raiseContextMenu

setPen

sigCopyRequested

sigDoubleClicked

sigRemoveRequested

center()[source]
Return type:

float

contextMenuEnabled()[source]
contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent | None)[source]
copy_clipboard()[source]
getMenu()[source]
mouseClickEvent(ev)[source]
pos()[source]
Return type:

Tuple[float, float]

raiseContextMenu(ev)[source]
setPen(color)[source]
setPos(pos)[source]
DESCRIPTOR: str = 'LinearROI'
DIMENSIONALITY: DataDim = 'Data1D'
property color
class pymodaq_gui.plotting.items.roi.ROI(*args, index=0, name='roi', compute=True, **kwargs)[source]

Bases: ROI, ROIMixin, ROIBase

Base class for all 2D ROI

Attributes:
color

Methods

center()

Get the center position of the ROI

contextMenuEvent(self, event)

set_center(center)

Set the center position of the ROI

contextMenuEnabled

copy_clipboard

getMenu

height

mouseClickEvent

raiseContextMenu

sigCopyRequested

sigDoubleClicked

sigRemoveRequested

width

center()[source]

Get the center position of the ROI

Return type:

Point

contextMenuEnabled()[source]
contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent | None)[source]
copy_clipboard()[source]
getMenu()[source]
height()[source]
Return type:

float

mouseClickEvent(ev)[source]
raiseContextMenu(ev)[source]
set_center(center)[source]

Set the center position of the ROI

width()[source]
Return type:

float

property color
class pymodaq_gui.plotting.items.roi.ROIBase[source]

Bases: object

Base class to be inherited for ROI to be created by the factory

DESCRIPTOR: str = NotImplemented
DIMENSIONALITY: DataDim = NotImplemented
class pymodaq_gui.plotting.items.roi.ROIBrushable(brush=None, *args, **kwargs)[source]

Bases: ROI

Methods

paint(self, painter, option[, widget])

setBrush(*br, **kargs)

Set the brush that fills the region.

paint(self, painter: QPainter | None, option: QStyleOptionGraphicsItem | None, widget: QWidget | None = None)[source]
setBrush(*br, **kargs)[source]

Set the brush that fills the region. Can have any arguments that are valid for mkBrush.

class pymodaq_gui.plotting.items.roi.ROIFactory[source]

Bases: object

The factory class for creating ROI

Methods

create(dimensionality, descriptor, *args, ...)

Factory command to create the ROI object.

get_descriptors_from_dimensionality(dim)

Returns a list of ROi descriptors for a given dimensionality

get_dimensionality()

Returns a list of registered dimensionality

register()

Class decorator method to register ROI class to the internal registry.

classmethod create(dimensionality, descriptor, *args, **kwargs)[source]

Factory command to create the ROI object. This method gets the appropriate ROI class from the registry and instantiates it. :param dimensionality: the dimensionality of the ROI :type dimensionality: DataDim :param descriptor: the roi descriptor string :type descriptor: str

Return type:

ROIBase

classmethod get_descriptors_from_dimensionality(dim)[source]

Returns a list of ROi descriptors for a given dimensionality

classmethod get_dimensionality()[source]

Returns a list of registered dimensionality

classmethod register()[source]

Class decorator method to register ROI class to the internal registry. Must be used as decorator above the definition of a ROI class.

Return type:

Callable

registry = {DataDim.Data1D: {'LinearROI': <class 'pymodaq_gui.plotting.items.roi.LinearROI'>}, DataDim.Data2D: {'CircularROI': <class 'pymodaq_gui.plotting.items.roi.CircularROI'>, 'EllipseROI': <class 'pymodaq_gui.plotting.items.roi.EllipseROI'>, 'RectROI': <class 'pymodaq_gui.plotting.items.roi.RectROI'>}}
class pymodaq_gui.plotting.items.roi.ROIMixin(index=0, name='roi', compute=True)[source]

Bases: object

Attributes:
compute

Methods

center

color

copy_clipboard

doShow

emit_index_signal

getMenu

height

index_signal

init_qt

key

mouseClickEvent

mouseDoubleClickEvent

type

width

abstractmethod center()[source]
abstractmethod color()[source]
abstractmethod copy_clipboard()[source]
doShow(status=True)[source]
emit_index_signal()[source]
abstractmethod getMenu()[source]
abstractmethod height()[source]
init_qt()[source]
key()[source]
Return type:

str

abstractmethod mouseClickEvent(ev)[source]
mouseDoubleClickEvent(ev)[source]
type()[source]
Return type:

str

abstractmethod width()[source]
property compute
class pymodaq_gui.plotting.items.roi.ROIPositionMapper(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Widget presenting a Tree structure representing a ROI positions.

Methods

show_dialog

show_dialog()[source]
class pymodaq_gui.plotting.items.roi.RectROI(index=0, pos=[0, 0], size=[10, 10], **kwargs)[source]

Bases: ROI

DESCRIPTOR: str = 'RectROI'
DIMENSIONALITY: DataDim = 'Data2D'
class pymodaq_gui.plotting.items.roi.SimpleRectROI(pos=[0, 0], size=[10, 10], centered=False, sideScalers=False, **args)[source]

Bases: ROI

Rectangular ROI subclass with a single scale handle at the top-right corner.

pymodaq_gui.plotting.items.roi.roi_format(index)[source]
pymodaq_gui.plotting.items.roi.translate(context: str, sourceText: str, disambiguation: str = None, n: int = -1) str
Return type:

str