Files
Jungfraujoch/viewer/JFJochViewerImageROIStatistics_Box.cpp
Filip Leonarski 4dbbf0e365
Some checks failed
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m11s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m9s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 9m18s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m14s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 10m3s
Build Packages / Generate python client (push) Successful in 15s
Build Packages / Build documentation (push) Successful in 50s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 8m31s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 8m21s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m42s
Build Packages / build:rpm (rocky9) (push) Successful in 9m11s
Build Packages / Unit tests (push) Failing after 1h13m19s
v1.0.0-rc.97
This is an UNSTABLE release and not recommended for production use (please use rc.96 instead).

* jfjoch_broker: For DECTRIS detectors add dark data collection during initialization for bad pixel mask
* jfjoch_broker: Refactor of calibration logic for more clear code (likely to introduce problems)
* jfjoch_viewer: Add option to handle user pixel mask (experimental)
* jfjoch_viewer: More options for ROI
* jfjoch_viewer: Add window to display calibration

Reviewed-on: #2
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
2025-11-09 12:42:27 +01:00

72 lines
2.2 KiB
C++

// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include <QHBoxLayout>
#include "JFJochViewerImageROIStatistics_Box.h"
#include <QLabel>
JFJochViewerImageROIStatistics_Box::JFJochViewerImageROIStatistics_Box(QWidget *parent)
: QWidget(parent) {
auto layout = new QHBoxLayout(this);
setFixedWidth(300);
layout->addWidget(new QLabel("x:"));
x0 = new NumberLineEdit(0, 10000, 0, 0, "", this);
x0->setFixedWidth(50);
layout->addWidget(x0);
layout->addWidget(new QLabel(" - "));
x1 = new NumberLineEdit(0, 10000, 0, 0, "", this);
x1->setFixedWidth(50);
layout->addWidget(x1);
layout->addWidget(new QLabel(" y:"));
y0 = new NumberLineEdit(0, 10000, 0, 0, "", this);
y0->setFixedWidth(50);
layout->addWidget(y0);
layout->addWidget(new QLabel(" - "));
y1 = new NumberLineEdit(0, 10000, 0, 0, "", this);
y1->setFixedWidth(50);
layout->addWidget(y1);
connect(x0, &NumberLineEdit::newValue, [this] (float) { emit Updated(); } );
connect(y0, &NumberLineEdit::newValue, [this] (float) { emit Updated(); } );
connect(x1, &NumberLineEdit::newValue, [this] (float) { emit Updated(); } );
connect(y1, &NumberLineEdit::newValue, [this] (float) { emit Updated(); } );
}
void JFJochViewerImageROIStatistics_Box::ROIBoxConfigured(QRect box) {
Enable();
x0->setValue(box.left());
x1->setValue(box.right());
y0->setValue(box.top());
y1->setValue(box.bottom());
}
void JFJochViewerImageROIStatistics_Box::Disable() {
x0->setEnabled(false);
x1->setEnabled(false);
y0->setEnabled(false);
y1->setEnabled(false);
}
void JFJochViewerImageROIStatistics_Box::Enable() {
x0->setEnabled(true);
x1->setEnabled(true);
y0->setEnabled(true);
y1->setEnabled(true);
}
QRect JFJochViewerImageROIStatistics_Box::GetROIBox() {
int64_t out_x0 = std::lround(x0->value());
int64_t out_x1 = std::lround(x1->value());
int64_t out_y0 = std::lround(y0->value());
int64_t out_y1 = std::lround(y1->value());
return QRect(out_x0, out_y0, out_x1 - out_x0, out_y1 - out_y0).normalized();
}