c981e1b91c
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 10m7s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 10m35s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 11m8s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 9m24s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 11m29s
Build Packages / build:rpm (rocky8) (push) Successful in 10m27s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 11m41s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 11m1s
Build Packages / Generate python client (push) Successful in 45s
Build Packages / Unit tests (push) Has been skipped
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky9) (push) Successful in 12m48s
Build Packages / Build documentation (push) Successful in 1m3s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 12m10s
Build Packages / XDS test (durin plugin) (push) Successful in 8m59s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m32s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 8m39s
Build Packages / DIALS test (push) Successful in 13m13s
This is an UNSTABLE release. The release has significant modifications and bug fixes, if things go wrong, it is better to revert to 1.0.0-rc.132. * jfjoch_broker: Better track time for each operation in the processing stack * jfjoch_broker: Rewrite preprocessing of diffraction images in the non-FPGA workflow to better use GPUs (work in progress) * jfjoch_broker: Remove ROI calculation in the non-FPGA workflow (work in progress) * jfjoch_viewer: Toolbar displays image number starting from 1 (instead of 0) Reviewed-on: #46
161 lines
5.4 KiB
C++
161 lines
5.4 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "JFJochViewerImageListWindow.h"
|
|
|
|
#include <QVBoxLayout>
|
|
#include <QHeaderView>
|
|
#include <QCloseEvent>
|
|
|
|
JFJochViewerImageListWindow::JFJochViewerImageListWindow(QWidget *parent) : JFJochHelperWindow(parent) {
|
|
|
|
QWidget *centralWidget = new QWidget(this);
|
|
setCentralWidget(centralWidget);
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(centralWidget);
|
|
|
|
tableView = new QTableView(this);
|
|
|
|
tableModel = new QStandardItemModel(this);
|
|
setupTableModel();
|
|
|
|
proxyModel = new QSortFilterProxyModel(this);
|
|
proxyModel->setSourceModel(tableModel);
|
|
|
|
tableView->setModel(proxyModel);
|
|
tableView->sortByColumn(0, Qt::AscendingOrder);
|
|
tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
tableView->setSortingEnabled(true);
|
|
tableView->verticalHeader()->setVisible(false);
|
|
tableView->horizontalHeader()->setSectionsClickable(true);
|
|
tableView->horizontalHeader()->setSortIndicatorShown(true);
|
|
|
|
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
|
|
|
layout->addWidget(tableView);
|
|
|
|
setWindowTitle("Image statistics");
|
|
resize(800, 600);
|
|
|
|
connect(tableView, &QTableView::doubleClicked, this, &JFJochViewerImageListWindow::onTableRowDoubleClicked);
|
|
}
|
|
|
|
void JFJochViewerImageListWindow::setupTableModel()
|
|
{
|
|
tableModel->setColumnCount(6);
|
|
tableModel->setHeaderData(0, Qt::Horizontal, "#");
|
|
tableModel->setHeaderData(1, Qt::Horizontal, "Background");
|
|
tableModel->setHeaderData(2, Qt::Horizontal, "Indexing");
|
|
tableModel->setHeaderData(3, Qt::Horizontal, "Spots");
|
|
tableModel->setHeaderData(4, Qt::Horizontal, "Res. estimate");
|
|
tableModel->setHeaderData(5, Qt::Horizontal, "Max");
|
|
}
|
|
|
|
void JFJochViewerImageListWindow::addDataRow(int imageNumber, double backgroundEstimate,
|
|
const QString& indexingResult,
|
|
int spotCount,
|
|
double resolutionEstimate,
|
|
int64_t max_value) {
|
|
QList<QStandardItem*> rowItems;
|
|
|
|
QStandardItem *imageItem = new QStandardItem();
|
|
imageItem->setData(imageNumber, Qt::DisplayRole);
|
|
rowItems.append(imageItem);
|
|
|
|
QStandardItem *bgItem = new QStandardItem();
|
|
bgItem->setData(backgroundEstimate, Qt::DisplayRole);
|
|
rowItems.append(bgItem);
|
|
|
|
QStandardItem *indexingItem = new QStandardItem(indexingResult);
|
|
rowItems.append(indexingItem);
|
|
|
|
QStandardItem *spotItem = new QStandardItem();
|
|
spotItem->setData(spotCount, Qt::DisplayRole);
|
|
rowItems.append(spotItem);
|
|
|
|
QStandardItem *resolutionItem = new QStandardItem();
|
|
resolutionItem->setData(resolutionEstimate, Qt::DisplayRole);
|
|
rowItems.append(resolutionItem);
|
|
|
|
|
|
QStandardItem *maxValueItem = new QStandardItem();
|
|
maxValueItem->setData(static_cast<int32_t>(max_value), Qt::DisplayRole);
|
|
rowItems.append(maxValueItem);
|
|
|
|
tableModel->appendRow(rowItems);
|
|
}
|
|
|
|
void JFJochViewerImageListWindow::clearAllData() {
|
|
tableModel->removeRows(0, tableModel->rowCount());
|
|
}
|
|
|
|
void JFJochViewerImageListWindow::datasetLoaded(std::shared_ptr<const JFJochReaderDataset> dataset) {
|
|
clearAllData();
|
|
|
|
if (!dataset)
|
|
return;
|
|
|
|
for (int i = 0; i < dataset->experiment.GetImageNum(); i++) {
|
|
float bkg_estimate = 0;
|
|
if (dataset->bkg_estimate.size() > i)
|
|
bkg_estimate = dataset->bkg_estimate[i];
|
|
|
|
int32_t spot_count = 0;
|
|
if (dataset->spot_count.size() > i)
|
|
spot_count = dataset->spot_count[i];
|
|
|
|
float res_estimation = 0.0f;
|
|
if (dataset->resolution_estimate.size() > i)
|
|
res_estimation = dataset->resolution_estimate[i];
|
|
|
|
QString indexing_result = "N/A";
|
|
if (dataset->indexing_result.size() > i) {
|
|
if (dataset->indexing_result[i] == 0)
|
|
indexing_result = "No";
|
|
else
|
|
indexing_result = "Yes";
|
|
}
|
|
|
|
int64_t max_value = 0;
|
|
if (dataset->max_value.size() > i)
|
|
max_value = dataset->max_value[i];
|
|
|
|
addDataRow(i + 1,
|
|
bkg_estimate,
|
|
indexing_result,
|
|
spot_count,
|
|
res_estimation,
|
|
max_value);
|
|
}
|
|
}
|
|
|
|
void JFJochViewerImageListWindow::imageLoaded(std::shared_ptr<const JFJochReaderImage> image) {
|
|
int curr_row = -1;
|
|
if (image)
|
|
curr_row = image->ImageData().number;
|
|
|
|
for (int row = 0; row < tableModel->rowCount(); row++) {
|
|
for (int col = 0; col < tableModel->columnCount(); ++col) {
|
|
QStandardItem *item = tableModel->item(row, col);
|
|
if (item) {
|
|
if (row == curr_row)
|
|
item->setBackground(Qt::blue);
|
|
else
|
|
item->setBackground(Qt::white);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void JFJochViewerImageListWindow::onTableRowDoubleClicked(const QModelIndex &index) {
|
|
if (!index.isValid())
|
|
return;
|
|
|
|
QModelIndex sourceIndex = proxyModel->mapToSource(index);
|
|
int imageNumber = tableModel->item(sourceIndex.row(), 0)->data(Qt::DisplayRole).toInt();
|
|
emit imageSelected(imageNumber - 1, 1);
|
|
}
|