Skip to content

CameraRoiWidget

CameraRoiWidget widget

This image generated from example code below.

CameraRoiWidget #

Bases: QWidget

A Widget to control the camera device ROI.

When the ROI changes, the roiChanged Signal is emitted with the current ROI (x, y, width, height, comboBoxText)

Parameters:

Name Type Description Default
parent QWidget | None

Optional parent widget, by default None

None
mmcore CMMCorePlus | None

Optional pymmcore_plus.CMMCorePlus micromanager core. By default, None. If not specified, the widget will use the active (or create a new) CMMCorePlus.instance.

None

_clearROI() -> None #

Clear the Camera ROI and reset to full chip.

_emit_roi_changed_signal() -> None #

Update the camera info with the new ROI values.

_get_loaded_cameras() -> list[str] #

Get the list of loaded cameras.

It excludes the Micro-Manager Multi Camera Utilities adapter.

_get_roi_values() -> tuple[int, int, int, int] #

Get the current ROI values for the selected camera.

_get_updated_crop_mode(camera: str, start_x: int, start_y: int, width: int, height: int) -> str #

Get the updated crop mode based on the roi values.

_on_camera_changed(camera: str) -> None #

Update the ROI When the camera combo box changes.

_on_center_checkbox(state: bool) -> None #

Handle the center checkbox state change.

_on_crop_button_clicked() -> None #

Handle the crop button click event.

_on_crop_roi_mode_change(value: str) -> None #

Handle the crop mode change.

_on_property_changed(device: str, prop: str, value: str) -> None #

Handle the property changed event.

_on_roi_set(camera: str, x: int, y: int, width: int, height: int) -> None #

Handle the ROI set event.

_on_roi_width_height_changed() -> None #

Handle the roi width and height spinbox value change.

_on_start_spinbox_changed() -> None #

Handle the start_x and start_y spinbox value change.

_prepare_roi_combo_items(camera: str) -> list[str] #

Prepare the ROI combo items that will be displayed in the combo box.

_reset_crop_mode_combo() -> None #

Reset the crop mode combo with the selected camera options.

_store_camera_info(cameras: list[str]) -> None #

Store the camera information in the _cameras dict.

_update_lbl_info() -> None #

Update the info label with the current ROI information.

_update_roi_values(roi: ROI | None = None) -> None #

Set the ROI values for the specified camera.

_update_start_max_value() -> None #

Update the maximum value for the start_x and start_y spinboxes.

value() -> dict[str, CameraInfo] #

Return the camera information dict.

Example#

camera_roi_widget.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from pymmcore_plus import CMMCorePlus
from qtpy.QtWidgets import QApplication

from pymmcore_widgets import CameraRoiWidget

app = QApplication([])

mmc = CMMCorePlus().instance()
mmc.loadSystemConfiguration()

# this widget supports multiple camera devices
mmc.loadDevice("Camera2", "DemoCamera", "DCam")
mmc.initializeDevice("Camera2")

cam_roi_wdg = CameraRoiWidget()
cam_roi_wdg.show()

app.exec()