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(self)

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(self) QPainterPath[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(self)

setPos(setPos)

center

contextMenuEnabled

copy_clipboard

getMenu

mouseClickEvent

raiseContextMenu

setPen

sigCopyRequested

sigDoubleClicked

sigRemoveRequested

center() float[source]
contextMenuEnabled()[source]
contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent | None)[source]
copy_clipboard()[source]
getMenu()[source]
mouseClickEvent(ev)[source]
pos(self) QPointF[source]
raiseContextMenu(ev)[source]
setPen(color)[source]
setPos(self, pos: QPointF) setPos(self, ax: float, ay: float)[source]
setPos(self, ax: float, ay: float) None
DESCRIPTOR: str = 'LinearROI'
DIMENSIONALITY: DataDim = 'Data1D'
property color
sigCopyRequested

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sigDoubleClicked

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sigRemoveRequested

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

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() Point[source]

Get the center position of the ROI

contextMenuEnabled()[source]
contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent | None)[source]
copy_clipboard()[source]
getMenu()[source]
height() float[source]
mouseClickEvent(ev)[source]
raiseContextMenu(ev)[source]
set_center(center: Point | Tuple[float, float])[source]

Set the center position of the ROI

width() float[source]
property color
sigCopyRequested

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sigDoubleClicked

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sigRemoveRequested

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

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: DataDim, descriptor: str, *args, **kwargs) ROIBase[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:

an instance of the ROI created

classmethod get_descriptors_from_dimensionality(dim: DataDim)[source]

Returns a list of ROi descriptors for a given dimensionality

classmethod get_dimensionality()[source]

Returns a list of registered dimensionality

classmethod register() Callable[source]

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

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: QObject

Attributes:
compute

Methods

center

color

copy_clipboard

doShow

emit_index_signal

getMenu

height

index_signal

key

mouseClickEvent

mouseDoubleClickEvent

type

width

abstractmethod center()[source]
abstractmethod color()[source]
abstractmethod copy_clipboard()[source]
doShow(status: bool = True)[source]
emit_index_signal()[source]
abstractmethod getMenu()[source]
abstractmethod height()[source]
key() str[source]
abstractmethod mouseClickEvent(ev)[source]
mouseDoubleClickEvent(ev)[source]
type() str[source]
abstractmethod width()[source]
property compute
index_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

class pymodaq_gui.plotting.items.roi.ROIPositionMapper(roi_pos, roi_size)[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 | None, sourceText: str | None, disambiguation: str | None = None, n: int = -1) str