From cd31747c9900039886ceecb0d3bdef22565b6e2a Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Tue, 8 Sep 2026 00:00:13 +0200 Subject: [PATCH] viewer: TEMPORARY STUB - the grid-scan composite reads protein, ice and the crystal list from a local placeholder REVERT THIS COMMIT AT INTEGRATION. protein_score, ice_score and the grid-scan crystal list are not on JFJochReaderDataset yet; they arrive through reader/ with a separate change. Until then GridScanDataStub.h defines GridScanCrystal and three accessors that return nothing, so the widget and the dataset-info panel are already written against the real shape of the data and compile today. Reverting this commit leaves exactly the two includes and the CMake entry to replace: take GridScanCrystal from the reader, and the three accessors become ds.protein_score, ds.ice_score and ds.grid_scan_result at their call sites in JFJochViewerDatasetInfo.cpp. Nothing else changes - both data paths fill the same JFJochReaderDataset, so HTTP and HDF5 light up together. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01EFEJG6WBQv8th4UJFNe53N --- viewer/CMakeLists.txt | 1 + viewer/GridScanDataStub.h | 56 +++++++++++++++++++++++ viewer/JFJochViewerDatasetInfo.cpp | 1 + viewer/image_viewer/JFJochGridScanImage.h | 1 + 4 files changed, 59 insertions(+) create mode 100644 viewer/GridScanDataStub.h diff --git a/viewer/CMakeLists.txt b/viewer/CMakeLists.txt index 6f227c432..d8b72df09 100644 --- a/viewer/CMakeLists.txt +++ b/viewer/CMakeLists.txt @@ -104,6 +104,7 @@ ADD_EXECUTABLE(jfjoch_viewer jfjoch_viewer.cpp JFJochViewerWindow.cpp JFJochView image_viewer/JFJochGridScanImage.cpp image_viewer/JFJochGridScanImage.h image_viewer/GridScanComposite.h + GridScanDataStub.h widgets/PowderCalibrationWidget.cpp widgets/PowderCalibrationWidget.h ${APP_RESOURCES} diff --git a/viewer/GridScanDataStub.h b/viewer/GridScanDataStub.h new file mode 100644 index 000000000..634515962 --- /dev/null +++ b/viewer/GridScanDataStub.h @@ -0,0 +1,56 @@ +// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute +// SPDX-License-Identifier: GPL-3.0-only + +#pragma once + +#include + +#include "../reader/JFJochReaderDataset.h" + +// =========================================================================================== +// STUB - DELETE THIS FILE AT INTEGRATION. +// +// The composite grid-scan map is drawn from the per-image protein and ice scores and from the +// crystal list of the whole raster. None of the three is on JFJochReaderDataset yet; they arrive +// with a separate change, through reader/. Until then this header is the one place in the viewer +// that names them, so the widget and the dataset-info panel are already written against the real +// shape of the data. +// +// At integration: drop this file and its two includes (image_viewer/JFJochGridScanImage.h and +// JFJochViewerDatasetInfo.cpp), take GridScanCrystal from the reader instead, and replace the three +// accessors below with `ds.protein_score`, `ds.ice_score` and `ds.grid_scan_result` at their call +// sites in JFJochViewerDatasetInfo.cpp. Nothing else has to change: both data paths (HTTP and HDF5) +// fill the same JFJochReaderDataset, so both light up at once. +// =========================================================================================== + +// One crystal found in a grid scan. Position and extent are in the grid's own frame; the extent is +// along the crystal's own principal axes, which is why angle_deg is needed to draw it. +struct GridScanCrystal { + float nx = 0; // centre, fractional grid coordinates, 0-based + float ny = 0; + float x_um = 0; // centre, signed offset along the grid axes + float y_um = 0; + int64_t image_number = -1; + float major_um = 0; // extent along the crystal's own principal axes + float minor_um = 0; + float angle_deg = 0; // major axis from +x grid axis, counter-clockwise, in [0, 180) + float score = 0; + float ice_score = 0; + float res_A = 0; + int64_t n_images = 0; +}; + +inline const std::vector &GridScanProteinScore(const JFJochReaderDataset &) { + static const std::vector none; + return none; +} + +inline const std::vector &GridScanIceScore(const JFJochReaderDataset &) { + static const std::vector none; + return none; +} + +inline const std::vector &GridScanCrystals(const JFJochReaderDataset &) { + static const std::vector none; + return none; +} diff --git a/viewer/JFJochViewerDatasetInfo.cpp b/viewer/JFJochViewerDatasetInfo.cpp index 87e450886..ac31320fd 100644 --- a/viewer/JFJochViewerDatasetInfo.cpp +++ b/viewer/JFJochViewerDatasetInfo.cpp @@ -6,6 +6,7 @@ #include #include "JFJochViewerDatasetInfo.h" +#include "GridScanDataStub.h" // STUB - see the note in that file namespace { // Stable colour per run by its position in the run list (Original is index 0 -> blue), so a diff --git a/viewer/image_viewer/JFJochGridScanImage.h b/viewer/image_viewer/JFJochGridScanImage.h index ab7b32f68..2af6f44eb 100644 --- a/viewer/image_viewer/JFJochGridScanImage.h +++ b/viewer/image_viewer/JFJochGridScanImage.h @@ -5,6 +5,7 @@ #include "JFJochImage.h" #include "GridScanComposite.h" +#include "../GridScanDataStub.h" // STUB: GridScanCrystal - see the note in that file #include "../../reader/JFJochReaderDataset.h" Q_DECLARE_METATYPE(GridScanSettings)