All checks were successful
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 11m48s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 12m18s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 12m18s
Build Packages / build:rpm (rocky8) (push) Successful in 11m43s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 12m31s
Build Packages / Unit tests (push) Has been skipped
Build Packages / Generate python client (push) Successful in 17s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 13m2s
Build Packages / Build documentation (push) Successful in 37s
Build Packages / build:rpm (rocky9) (push) Successful in 9m45s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 6m35s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 7m8s
This is an UNSTABLE release. * jfjoch_viewer: Auto load is better handling change of states * jfjoch_viewer: Fix DBus registration * jfjoch_viewer: Handle charts better with vertical lines on hover and status bar update * jfjoch_viewer: Calculate ROI in a more efficient way Reviewed-on: #6 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch> Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
100 lines
3.2 KiB
C++
100 lines
3.2 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <QGridLayout>
|
|
#include <QPushButton>
|
|
|
|
#include "JFJochViewerDatasetInfo.h"
|
|
|
|
JFJochViewerDatasetInfo::JFJochViewerDatasetInfo(QWidget *parent) : QWidget(parent) {
|
|
setFixedHeight(200);
|
|
|
|
auto layout = new QGridLayout(this);
|
|
combo_box = new QComboBox(this);
|
|
|
|
combo_box->addItem("Background estimate", 0);
|
|
combo_box->addItem("Spot count", 1);
|
|
combo_box->addItem("Spot count (indexed)", 2);
|
|
combo_box->addItem("Spot count (ice rings)", 3);
|
|
combo_box->addItem("Spot count (low res.)", 4);
|
|
combo_box->addItem("Indexing result", 5);
|
|
combo_box->addItem("Profile radius", 6);
|
|
combo_box->setCurrentIndex(0);
|
|
|
|
layout->addWidget(combo_box, 0, 0);
|
|
|
|
auto reset_button = new QPushButton("Reset zoom", this);
|
|
layout->addWidget(reset_button, 0, 1);
|
|
|
|
chart_view = new JFJochChartView(this);
|
|
layout->addWidget(chart_view, 1, 0, 1, 2);
|
|
|
|
connect(chart_view, &JFJochChartView::imageSelected,
|
|
this, &JFJochViewerDatasetInfo::imageSelectedInChart);
|
|
|
|
connect(reset_button, &QPushButton::clicked,
|
|
chart_view, &JFJochChartView::resetZoom);
|
|
|
|
connect(combo_box, &QComboBox::currentIndexChanged,
|
|
this, &JFJochViewerDatasetInfo::comboBoxSelected);
|
|
|
|
connect(chart_view, &JFJochChartView::writeStatusBar,
|
|
[this] (QString string, int timeout_ms) {
|
|
emit writeStatusBar(string, timeout_ms);
|
|
});
|
|
|
|
setLayout(layout);
|
|
}
|
|
|
|
void JFJochViewerDatasetInfo::datasetLoaded(std::shared_ptr<const JFJochReaderDataset> dataset) {
|
|
this->dataset = dataset;
|
|
if (dataset) {
|
|
UpdatePlot();
|
|
} else
|
|
chart_view->loadValues<float>({}, 0);
|
|
}
|
|
|
|
void JFJochViewerDatasetInfo::imageLoaded(std::shared_ptr<const JFJochReaderImage> image) {
|
|
this->image = image;
|
|
if (image)
|
|
chart_view->setImage(image->ImageData().number);
|
|
}
|
|
|
|
void JFJochViewerDatasetInfo::imageSelectedInChart(int64_t number) {
|
|
emit imageSelected(number, 1);
|
|
}
|
|
|
|
void JFJochViewerDatasetInfo::UpdatePlot() {
|
|
int index = combo_box->currentIndex();
|
|
int val = combo_box->itemData(index).toInt();
|
|
|
|
std::vector<float> tmp;
|
|
if (dataset) {
|
|
int64_t image_number = 0;
|
|
if (image)
|
|
image_number = image->ImageData().number;
|
|
|
|
if (val == 0)
|
|
chart_view->loadValues(dataset->bkg_estimate, image_number);
|
|
else if (val == 1)
|
|
chart_view->loadValues(dataset->spot_count, image_number);
|
|
else if (val == 2)
|
|
chart_view->loadValues(dataset->spot_count_indexed, image_number);
|
|
else if (val == 3)
|
|
chart_view->loadValues(dataset->spot_count_ice_rings, image_number);
|
|
else if (val == 4)
|
|
chart_view->loadValues(dataset->spot_count_low_res, image_number);
|
|
else if (val == 5)
|
|
chart_view->loadValues(dataset->indexing_result, image_number);
|
|
else if (val == 6)
|
|
chart_view->loadValues(dataset->profile_radius, image_number);
|
|
else
|
|
chart_view->loadValues<float>({}, 0);
|
|
}
|
|
|
|
}
|
|
|
|
void JFJochViewerDatasetInfo::comboBoxSelected(int index) {
|
|
UpdatePlot();
|
|
}
|