From e7edee6b2ed5bc6a384eea421ced4dc28e911087 Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Tue, 23 Jun 2026 09:49:36 +0200 Subject: [PATCH] =?UTF-8?q?viewer:=20Phase=201c=20=E2=80=94=20fold=20per-i?= =?UTF-8?q?mage=20plot=20into=20the=20dataset-info=20dock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- viewer/JFJochViewerDatasetInfo.cpp | 43 ++++++++++++++++++++++++------ viewer/JFJochViewerDatasetInfo.h | 4 +++ viewer/JFJochViewerSidePanel.cpp | 12 ++------- viewer/JFJochViewerSidePanel.h | 2 -- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/viewer/JFJochViewerDatasetInfo.cpp b/viewer/JFJochViewerDatasetInfo.cpp index aa0a535c..bc0cb932 100644 --- a/viewer/JFJochViewerDatasetInfo.cpp +++ b/viewer/JFJochViewerDatasetInfo.cpp @@ -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_ptrsetImage(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 runs, QString active_id) { diff --git a/viewer/JFJochViewerDatasetInfo.h b/viewer/JFJochViewerDatasetInfo.h index 1e84f557..e3d21d1d 100644 --- a/viewer/JFJochViewerDatasetInfo.h +++ b/viewer/JFJochViewerDatasetInfo.h @@ -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 dataset; // the active (primary) run std::shared_ptr image; JFJochGridScanImage *grid_scan_image = nullptr; + JFJochViewerSidePanelChart *image_chart = nullptr; // per-image profiles (azimuthal, Wilson, ...) QVector 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 ExtractMetric(const JFJochReaderDataset &ds, int val, bool &one_over_d2) const; diff --git a/viewer/JFJochViewerSidePanel.cpp b/viewer/JFJochViewerSidePanel.cpp index 85220768..30ce9694 100644 --- a/viewer/JFJochViewerSidePanel.cpp +++ b/viewer/JFJochViewerSidePanel.cpp @@ -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)); diff --git a/viewer/JFJochViewerSidePanel.h b/viewer/JFJochViewerSidePanel.h index 4aec0662..69c98279 100644 --- a/viewer/JFJochViewerSidePanel.h +++ b/viewer/JFJochViewerSidePanel.h @@ -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;