From e301b94e7c6137d3787b4a054ef3db886a83ea74 Mon Sep 17 00:00:00 2001 From: wyzula-jan Date: Mon, 3 Nov 2025 15:11:24 +0100 Subject: [PATCH] fix: add num_rotation_90 and transpose to ids_camera --- csaxs_bec/devices/ids_cameras/ids_camera.py | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/csaxs_bec/devices/ids_cameras/ids_camera.py b/csaxs_bec/devices/ids_cameras/ids_camera.py index 3111d61..5fecb90 100644 --- a/csaxs_bec/devices/ids_cameras/ids_camera.py +++ b/csaxs_bec/devices/ids_cameras/ids_camera.py @@ -19,7 +19,6 @@ if TYPE_CHECKING: from bec_lib.devicemanager import ScanInfo from pydantic import ValidationInfo - logger = bec_logger.logger @@ -30,7 +29,8 @@ class IDSCamera(PSIDeviceBase): to interact with the IDS camera using the pyueye library. """ - image = Cpt(PreviewSignal, name="image", ndim=2, doc="Preview signal for the camera.") + image = Cpt(PreviewSignal, name="image", ndim=2, doc="Preview signal for the camera.", num_rotation_90=0, + transpose=False) roi_signal = Cpt( AsyncSignal, name="roi_signal", @@ -43,16 +43,18 @@ class IDSCamera(PSIDeviceBase): USER_ACCESS = ["live_mode", "mask", "set_rect_roi", "get_last_image"] def __init__( - self, - *, - name: str, - camera_id: int, - prefix: str = "", - scan_info: ScanInfo | None = None, - m_n_colormode: Literal[0, 1, 2, 3] = 1, - bits_per_pixel: Literal[8, 24] = 24, - live_mode: bool = False, - **kwargs, + self, + *, + name: str, + camera_id: int, + prefix: str = "", + scan_info: ScanInfo | None = None, + m_n_colormode: Literal[0, 1, 2, 3] = 1, + bits_per_pixel: Literal[8, 24] = 24, + live_mode: bool = False, + num_rotation_90: int = 0, + transpose: bool = False, + **kwargs, ): """Initialize the IDS Camera. @@ -77,6 +79,8 @@ class IDSCamera(PSIDeviceBase): self._live_mode = False self._inputs = {"live_mode": live_mode} self._mask = np.zeros((1, 1), dtype=np.uint8) + self.image.num_rotation_90 = num_rotation_90 + self.image.transpose = transpose ############## Live Mode Methods ############## @@ -127,7 +131,7 @@ class IDSCamera(PSIDeviceBase): if x + width > img_shape[1] or y + height > img_shape[0]: raise ValueError("ROI exceeds camera dimensions.") mask = np.zeros(img_shape, dtype=np.uint8) - mask[y : y + height, x : x + width] = 1 + mask[y: y + height, x: x + width] = 1 self.mask = mask def _start_live(self): -- 2.49.1