nexxT.examples.framework.ImageView module

This viewer is a showcase to see how to write a viewer for nexxT. Note that there are multiple possibilities to view images, and this one might actually not be the best option. You can use python toolkits such as pyqtgraph, matpllotlibs or others supporting a QT5 backend.

class nexxT.examples.framework.ImageView.DisplayWidget(parent=None)[source]

Bases: QWidget

The widget actually displaying the image. It has a scale parameter for setting the scale factor of the drawn image. The widget is created from the Filter instance. Both are QObjects and both have to run in the main (=GUI) thread of the QApplication.

__init__(self, /, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags), *, modal: bool | None = None, windowModality: PySide6.QtCore.Qt.WindowModality | None = None, enabled: bool | None = None, geometry: PySide6.QtCore.QRect | None = None, frameGeometry: PySide6.QtCore.QRect | None = None, normalGeometry: PySide6.QtCore.QRect | None = None, x: int | None = None, y: int | None = None, pos: PySide6.QtCore.QPoint | None = None, frameSize: PySide6.QtCore.QSize | None = None, size: PySide6.QtCore.QSize | None = None, width: int | None = None, height: int | None = None, rect: PySide6.QtCore.QRect | None = None, childrenRect: PySide6.QtCore.QRect | None = None, childrenRegion: PySide6.QtGui.QRegion | None = None, sizePolicy: PySide6.QtWidgets.QSizePolicy | None = None, minimumSize: PySide6.QtCore.QSize | None = None, maximumSize: PySide6.QtCore.QSize | None = None, minimumWidth: int | None = None, minimumHeight: int | None = None, maximumWidth: int | None = None, maximumHeight: int | None = None, sizeIncrement: PySide6.QtCore.QSize | None = None, baseSize: PySide6.QtCore.QSize | None = None, palette: PySide6.QtGui.QPalette | None = None, font: PySide6.QtGui.QFont | None = None, cursor: PySide6.QtGui.QCursor | None = None, mouseTracking: bool | None = None, tabletTracking: bool | None = None, isActiveWindow: bool | None = None, focusPolicy: PySide6.QtCore.Qt.FocusPolicy | None = None, focus: bool | None = None, contextMenuPolicy: PySide6.QtCore.Qt.ContextMenuPolicy | None = None, updatesEnabled: bool | None = None, visible: bool | None = None, minimized: bool | None = None, maximized: bool | None = None, fullScreen: bool | None = None, sizeHint: PySide6.QtCore.QSize | None = None, minimumSizeHint: PySide6.QtCore.QSize | None = None, acceptDrops: bool | None = None, windowTitle: str | None = None, windowIcon: PySide6.QtGui.QIcon | None = None, windowIconText: str | None = None, windowOpacity: float | None = None, windowModified: bool | None = None, toolTip: str | None = None, toolTipDuration: int | None = None, statusTip: str | None = None, whatsThis: str | None = None, accessibleName: str | None = None, accessibleDescription: str | None = None, layoutDirection: PySide6.QtCore.Qt.LayoutDirection | None = None, autoFillBackground: bool | None = None, styleSheet: str | None = None, locale: PySide6.QtCore.QLocale | None = None, windowFilePath: str | None = None, inputMethodHints: PySide6.QtCore.Qt.InputMethodHint | None = None) None[source]

Initialize self. See help(type(self)) for accurate signature.

checkSize()[source]

make sure that the minimum size is consistent with the shown image.

Returns:

paintEvent(paintEvent)[source]

The paint event actually drawing the image

Parameters:

paintEvent – a QPaintEvent instance

Returns:

setData(data)[source]

Called when new data arrives. This function converts the numpy array to a QImage which can then be drawn with a QT painter.

Parameters:

data – the image as a numpy array

Returns:

setScale(scale)[source]

Set the scale factor

Parameters:

scale – a floating point (<1: size reduction)

Returns:

staticMetaObject = PySide6.QtCore.QMetaObject("DisplayWidget" inherits "QWidget": )
class nexxT.examples.framework.ImageView.ImageView(env)[source]

Bases: Filter

This is the filter receiving the image data to be drawn. It has to be run in the GUI thread.

__init__(env)[source]

Filter Constructor.

Parameters:
  • dynInPortsSupported – Flag whether this filter supports dynamic input ports

  • dynOutPortsSupported – Flag whether this filter supports dynamic output ports

  • environment – FilterEnvironment instance which shall be passed through from the filter constructor.

interpretAndUpdate()[source]

The deferred update method, called from the MainWindow service at user-defined framerate.

onClose()[source]

Inverse of onOpen

Returns:

onOpen()[source]

Now we can create the widget.

Returns:

onPortDataChanged(port)[source]

Notification of new data.

Parameters:

port – the port where the data arrived.

Returns:

propChanged(propColl, name)[source]

Slot called whenever a property of this filter has changed.

Parameters:
  • pc – the PropertyCollection instance of this filter

  • name – the name of the changed parameter

Returns:

staticMetaObject = PySide6.QtCore.QMetaObject("ImageView" inherits "Filter": )