75e401f0e5
Build Packages / Unit tests (push) Successful in 1h31m59s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 8m43s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m5s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m27s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m56s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m24s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 10m27s
Build Packages / build:rpm (rocky8) (push) Successful in 9m20s
Build Packages / build:rpm (rocky9) (push) Successful in 10m50s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 9m54s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 8m38s
Build Packages / DIALS test (push) Successful in 12m13s
Build Packages / XDS test (durin plugin) (push) Successful in 7m8s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m8s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m50s
Build Packages / Generate python client (push) Successful in 16s
Build Packages / Build documentation (push) Successful in 50s
Build Packages / Create release (push) Skipped
This is an UNSTABLE release. It includes many experimental features, as well as many AI generated fixes. We recommend using rc.152 for production use. * jfjoch_broker: Add EXPERIMENTAL pixelrefine mode for image processing * jfjoch_broker: Allow to load user mask from 8-bit and 16-bit TIFF files * jfjoch_broker: Add ROI calculation in non-FPGA workflow * jfjoch_broker: Fixes to TCP image pusher * jfjoch_broker: Remove NUMA bindings * jfjoch_broker: Improvements to indexing * jfjoch_broker: For PSI EIGER, trimming energies are taken from the detector configuration (now compulsory) instead of hardcoded values * jfjoch_writer: Save ROI definitions and the per-pixel ROI bitmap in the master file; azimuthal ROIs support phi (angular) sectors * jfjoch_viewer: Major redesign with dockable panels and saved layouts, plus on-canvas creation/move/resize of box, circle and azimuthal ROIs * jfjoch_viewer: Run jfjoch_process reprocessing jobs from inside the GUI and overlay per-run results Reviewed-on: #63
74 lines
2.8 KiB
C++
74 lines
2.8 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 <cmath>
|
|
#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;
|
|
double std_dev = std::sqrt(std::max(0.0, variance));
|
|
|
|
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("Std <b>%1</b>").arg(QString::number(std_dev, '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));
|
|
if (roi.sum == 0) {
|
|
roi_x->setText(QString("x: <b>N/A</b>"));
|
|
roi_y->setText(QString("y: <b>N/A</b>"));
|
|
} else {
|
|
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("");
|
|
}
|
|
}
|