mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
roi constructor added
This commit is contained in:
parent
b47f751d66
commit
d31839e80e
@ -560,9 +560,7 @@ void qTabAdvanced::ClearROI() {
|
|||||||
|
|
||||||
void qTabAdvanced::SetROI() {
|
void qTabAdvanced::SetROI() {
|
||||||
|
|
||||||
slsDetectorDefs::ROI roi;
|
slsDetectorDefs::ROI roi(spinXmin->value(), spinXmax->value());
|
||||||
roi.xmin = spinXmin->value();
|
|
||||||
roi.xmax = spinXmax->value();
|
|
||||||
|
|
||||||
// set roi
|
// set roi
|
||||||
LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
|
LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
|
||||||
|
@ -1559,9 +1559,7 @@ std::string CmdProxy::ROI(int action) {
|
|||||||
if (args.size() != 2) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(2);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
defs::ROI t;
|
defs::ROI t(StringTo<int>(args[0]), StringTo<int>(args[1]));
|
||||||
t.xmin = StringTo<int>(args[0]);
|
|
||||||
t.xmax = StringTo<int>(args[1]);
|
|
||||||
det->setROI(t, det_id);
|
det->setROI(t, det_id);
|
||||||
os << '[' << t.xmin << ", " << t.xmax << "]\n";
|
os << '[' << t.xmin << ", " << t.xmax << "]\n";
|
||||||
} else {
|
} else {
|
||||||
|
@ -160,6 +160,8 @@ class slsDetectorDefs {
|
|||||||
struct ROI {
|
struct ROI {
|
||||||
int xmin{-1};
|
int xmin{-1};
|
||||||
int xmax{-1};
|
int xmax{-1};
|
||||||
|
ROI() = default;
|
||||||
|
ROI(int xmin, int xmax) : xmin(xmin), xmax(xmax){};
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
#else
|
#else
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -221,13 +221,13 @@ TEST_CASE("Detector type") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Formatting slsDetectorDefs::ROI") {
|
TEST_CASE("Formatting slsDetectorDefs::ROI") {
|
||||||
slsDetectorDefs::ROI roi{5, 159};
|
slsDetectorDefs::ROI roi(5, 159);
|
||||||
REQUIRE(ToString(roi) == "[5, 159]");
|
REQUIRE(ToString(roi) == "[5, 159]");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Streaming of slsDetectorDefs::ROI") {
|
TEST_CASE("Streaming of slsDetectorDefs::ROI") {
|
||||||
using namespace sls;
|
using namespace sls;
|
||||||
slsDetectorDefs::ROI roi{-10, 1};
|
slsDetectorDefs::ROI roi(-10, 1);
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << roi;
|
oss << roi;
|
||||||
REQUIRE(oss.str() == "[-10, 1]");
|
REQUIRE(oss.str() == "[-10, 1]");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user