Files
Jungfraujoch/viewer/widgets/JFJochViewerImageROIStatistics_Box.cpp
Filip Leonarski 95acf3aba3
All checks were successful
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 9m17s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m9s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 7m29s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 8m52s
Build Packages / Generate python client (push) Successful in 25s
Build Packages / Build documentation (push) Successful in 49s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 8m47s
Build Packages / build:rpm (rocky8) (push) Successful in 8m49s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m4s
Build Packages / build:rpm (rocky9) (push) Successful in 8m52s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 8m11s
Build Packages / Unit tests (push) Successful in 1h14m42s
v1.0.0-rc.104 (#9)
This is an UNSTABLE release.

jfjoch_writer: Fix and improve the way grid scan geometry is saved (non-NXmx extension makes it way easier)
jfjoch_viewer: Display grid scan results in 2D (work in progress)
jfjoch_viewer: Improve auto-scaling on start of images (work in progress)
jfjoch_viewer: Add B-factor and resolution estimate to the dataset info plots

Reviewed-on: #9
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
2025-11-19 17:28:10 +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();
}