mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-12-31 08:31:18 +01:00
API also allows single sequence for single ROI
This commit is contained in:
@@ -24,6 +24,7 @@ import datetime as dt
|
||||
|
||||
from functools import wraps
|
||||
from collections import namedtuple
|
||||
from collections.abc import Sequence
|
||||
import socket
|
||||
import numpy as np
|
||||
|
||||
@@ -321,7 +322,16 @@ class Detector(CppDetectorApi):
|
||||
Each ROI should be represented as a tuple of (x_start, y_start, x_end, y_end). \n
|
||||
Example: [(0, 100, 50, 100)] \n
|
||||
"""
|
||||
self.setRxROI(rois)
|
||||
# TODO: maybe better to accept py::object in setRxROI and handle there?
|
||||
if not isinstance(rois, Sequence):
|
||||
raise TypeError(
|
||||
"setRxROI failed: expected a tuple/list of ints x_min, x_max, y_min, y_max "
|
||||
"or a sequence of such."
|
||||
)
|
||||
if(not isinstance(rois[0], Sequence)):
|
||||
self.setRxROI([rois])
|
||||
else:
|
||||
self.setRxROI(rois)
|
||||
|
||||
|
||||
@property
|
||||
|
||||
@@ -938,6 +938,7 @@ void init_det(py::module &m) {
|
||||
(void(Detector::*)(const std::vector<defs::ROI> &)) &
|
||||
Detector::setRxROI,
|
||||
py::arg());
|
||||
|
||||
CppDetectorApi.def("clearRxROI",
|
||||
(void(Detector::*)()) & Detector::clearRxROI);
|
||||
CppDetectorApi.def(
|
||||
|
||||
Reference in New Issue
Block a user