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
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>
67 lines
2.6 KiB
C++
67 lines
2.6 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "JFJochViewerROIResult.h"
|
|
#include <QGridLayout>
|
|
|
|
JFJochViewerROIResult::JFJochViewerROIResult(QWidget *parent) : QWidget(parent) {
|
|
QGridLayout *layout = new QGridLayout;
|
|
|
|
roi_sum = new QLabel("", this);
|
|
roi_mean = new QLabel("", this);
|
|
roi_var = new QLabel("", this);
|
|
roi_max = new QLabel("", this);
|
|
roi_npixel = new QLabel("", this);
|
|
roi_masked = new QLabel("", this);
|
|
roi_x = new QLabel("", this);
|
|
roi_y = new QLabel("", this);
|
|
|
|
label_1 = new QLabel("", this);
|
|
label_2 = new QLabel("", this);
|
|
|
|
label_1->setAlignment(Qt::AlignCenter);
|
|
label_2->setAlignment(Qt::AlignCenter);
|
|
|
|
layout->addWidget(roi_mean, 0, 0);
|
|
layout->addWidget(roi_var, 0, 1);
|
|
layout->addWidget(roi_sum, 0, 2);
|
|
layout->addWidget(roi_max, 0, 3);
|
|
layout->addWidget(label_1, 1,0,1,2);
|
|
layout->addWidget(roi_npixel, 1, 2);
|
|
layout->addWidget(roi_masked, 1, 3);
|
|
layout->addWidget(label_2, 2,0,1,2);
|
|
layout->addWidget(roi_x, 2, 2);
|
|
layout->addWidget(roi_y, 2, 3);
|
|
setLayout(layout);
|
|
}
|
|
|
|
void JFJochViewerROIResult::SetROIResult(ROIMessage roi) {
|
|
if ( roi.pixels > 0) {
|
|
auto roi_npixel_val = static_cast<double>(roi.pixels);
|
|
double roi_mean_val = static_cast<double>(roi.sum) / roi_npixel_val;
|
|
double variance = static_cast<double>(roi.sum_square) / roi_npixel_val - roi_mean_val * roi_mean_val;
|
|
|
|
roi_sum->setText(QString("Sum <b>%1</b>").arg(roi.sum));
|
|
roi_mean->setText(QString("Mean <b>%1</b>").arg(QString::number(roi_mean_val, 'f', 3)));
|
|
roi_var->setText(QString("Var <b>%1</b>").arg(QString::number(variance, 'f', 3)));
|
|
roi_max->setText(QString("Max <b>%1</b>").arg(roi.max_count));
|
|
roi_npixel->setText(QString("Valid <b>%1</b>").arg(roi.pixels));
|
|
roi_masked->setText(QString("Masked <b>%1</b>").arg(roi.pixels_masked));
|
|
roi_x->setText(QString("x: <b>%1</b>").arg(static_cast<float>(roi.x_weighted) / roi.sum));
|
|
roi_y->setText(QString("y: <b>%1</b>").arg(static_cast<float>(roi.y_weighted) / roi.sum));
|
|
label_1->setText(QString("Pixel count"));
|
|
label_2->setText(QString("Center of mass"));
|
|
} else {
|
|
roi_sum->setText("");
|
|
roi_mean->setText("");
|
|
roi_var->setText("");
|
|
roi_max->setText("");
|
|
roi_npixel->setText("");
|
|
roi_masked->setText("");
|
|
roi_x->setText("");
|
|
roi_y->setText("");
|
|
label_1->setText("");
|
|
label_2->setText("");
|
|
}
|
|
}
|