viewer: Phase 1c — fold per-image plot into the dataset-info dock

Remove the duplicated per-image plot from the side panel and host it in the
dataset-info dock instead:

- JFJochViewerDatasetInfo gains a "Per-image" toggle (next to Grid) that swaps
  the stacked view to the existing JFJochViewerSidePanelChart (azimuthal 1D,
  Wilson, I/sigma, spot and fluorescence profiles of the current image). The
  per-dataset metric combo is disabled while in per-image mode.
- The per-image profile follows the displayed image (imageLoaded forwarded).
- Drop the "Image statistics plot" section from JFJochViewerSidePanel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 09:49:36 +02:00
parent 54526300a9
commit e7edee6b2e
4 changed files with 41 additions and 20 deletions
+35 -8
View File
@@ -42,18 +42,25 @@ JFJochViewerDatasetInfo::JFJochViewerDatasetInfo(QWidget *parent) : QWidget(pare
grid_button->setCheckable(true);
grid_button->setEnabled(false);
image_button = new QPushButton("Per-image", this);
image_button->setFixedWidth(100);
image_button->setCheckable(true);
layout->addWidget(reset_button, 0, 2);
layout->addWidget(grid_button, 0, 3);
layout->addWidget(image_button, 0, 4);
stack = new QStackedWidget(this);
chart_view = new JFJochDatasetInfoChartView(this);
chart_view->setMinimumHeight(80); // low floor so the bottom dock resizes freely (default is set via resizeDocks)
grid_scan_image = new JFJochGridScanImage(this);
image_chart = new JFJochViewerSidePanelChart(this); // per-image profiles, folded in from the side panel
stack->addWidget(chart_view);
stack->addWidget(grid_scan_image);
stack->addWidget(image_chart);
layout->addWidget(stack, 1, 0, 1, 4);
layout->addWidget(stack, 1, 0, 1, 5);
connect(chart_view, &JFJochDatasetInfoChartView::imageSelected,
this, &JFJochViewerDatasetInfo::imageSelectedInChart);
@@ -79,11 +86,21 @@ JFJochViewerDatasetInfo::JFJochViewerDatasetInfo(QWidget *parent) : QWidget(pare
connect(grid_button, &QPushButton::clicked,
[this]() {
if (grid_button->isChecked() && dataset && dataset->experiment.GetGridScan())
stack->setCurrentWidget(grid_scan_image);
else
stack->setCurrentWidget(chart_view);
if (grid_button->isChecked()) {
image_button->setChecked(false);
combo_box->setEnabled(true);
}
UpdateView();
});
connect(image_button, &QPushButton::clicked,
[this]() {
if (image_button->isChecked())
grid_button->setChecked(false);
combo_box->setEnabled(!image_button->isChecked()); // the metric combo is for the dataset plot
UpdateView();
});
connect(image_chart, &JFJochViewerSidePanelChart::writeStatusBar,
[this](QString s, int t) { emit writeStatusBar(s, t); });
setLayout(layout);
}
@@ -167,6 +184,7 @@ void JFJochViewerDatasetInfo::imageLoaded(std::shared_ptr<const JFJochReaderImag
chart_view->setImage(image->ImageData().number);
grid_scan_image->setImage(image->ImageData().number);
}
image_chart->loadImage(image); // per-image profile follows the displayed image
}
void JFJochViewerDatasetInfo::imageSelectedInChart(int64_t number) {
@@ -262,15 +280,24 @@ void JFJochViewerDatasetInfo::UpdatePlot() {
std::move(overlays), primary_color, XForRun(*dataset), full_range);
if (dataset->experiment.GetGridScan()) {
stack->setCurrentWidget(grid_scan_image);
grid_scan_image->loadData(data, dataset->experiment.GetGridScan().value(), one_over_d2);
grid_button->setEnabled(true);
grid_button->setChecked(true);
if (!image_button->isChecked())
grid_button->setChecked(true);
} else {
grid_scan_image->clear();
stack->setCurrentWidget(chart_view);
grid_button->setEnabled(false);
}
UpdateView();
}
void JFJochViewerDatasetInfo::UpdateView() {
if (image_button->isChecked())
stack->setCurrentWidget(image_chart);
else if (grid_button->isChecked() && dataset && dataset->experiment.GetGridScan())
stack->setCurrentWidget(grid_scan_image);
else
stack->setCurrentWidget(chart_view);
}
void JFJochViewerDatasetInfo::runsChanged(QVector<RunData> runs, QString active_id) {
+4
View File
@@ -10,6 +10,7 @@
#include "charts/JFJochDatasetInfoChartView.h"
#include "../reader/JFJochReader.h"
#include "image_viewer/JFJochGridScanImage.h"
#include "widgets/JFJochViewerSidePanelChart.h"
#include "RunData.h"
class JFJochViewerDatasetInfo : public QWidget {
@@ -20,6 +21,7 @@ class JFJochViewerDatasetInfo : public QWidget {
std::shared_ptr<const JFJochReaderDataset> dataset; // the active (primary) run
std::shared_ptr<const JFJochReaderImage> image;
JFJochGridScanImage *grid_scan_image = nullptr;
JFJochViewerSidePanelChart *image_chart = nullptr; // per-image profiles (azimuthal, Wilson, ...)
QVector<RunData> runs_; // all runs, for overlay lines
QString active_id_; // which run is primary
@@ -27,9 +29,11 @@ class JFJochViewerDatasetInfo : public QWidget {
QStackedWidget *stack = nullptr;
QPushButton *grid_button = nullptr;
QPushButton *image_button = nullptr; // toggle: show per-image profiles instead of the metric
int last_selection;
void UpdatePlot();
void UpdateView(); // pick the stack page from the grid / per-image toggles
// Pull the metric selected by combo value `val` out of one run's dataset.
std::vector<float> ExtractMetric(const JFJochReaderDataset &ds, int val, bool &one_over_d2) const;
+2 -10
View File
@@ -99,16 +99,8 @@ JFJochViewerSidePanel::JFJochViewerSidePanel(QWidget *parent) : QWidget(parent)
layout->addWidget(res_rings);
layout->addWidget(new TitleLabel("Image statistics plot", this));
chart = new JFJochViewerSidePanelChart(this);
layout->addWidget(chart);
connect(this, &JFJochViewerSidePanel::imageLoaded,
chart, &JFJochViewerSidePanelChart::loadImage);
connect(chart, &JFJochViewerSidePanelChart::writeStatusBar,
[&] (QString string, int timeout_ms) {
emit writeStatusBar(string, timeout_ms);
});
// The per-image statistics plot now lives in the dataset-info dock (its "Per-image" toggle),
// so it is no longer duplicated here.
layout->addWidget(new TitleLabel("ROI", this));
-2
View File
@@ -11,13 +11,11 @@
#include "widgets/JFJochViewerROIList.h"
#include "../reader/JFJochReader.h"
#include "charts/JFJochSimpleChartView.h"
#include "widgets/JFJochViewerSidePanelChart.h"
#include "widgets/ResolutionRingWidget.h"
class JFJochViewerSidePanel : public QWidget {
Q_OBJECT
JFJochViewerSidePanelChart *chart = nullptr;
JFJochViewerROIList *roi_list = nullptr;
ResolutionRingWidget *res_rings = nullptr;