From ed86b9b29e9f6a0005070b223d2900b9f90dc626 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 8 Nov 2026 08:42:43 +0100 Subject: [PATCH] viewer: index rotation frames one by one in interactive analysis The interactive analysers now read a member copy of the worker's experiment with rotation indexing off, so a rotation frame is indexed and predicted on its own, like a still. They used to wait for the online rotation-indexer counter, which is about to go; the rotation indexer itself needs the whole sweep, which only a processing job reads, and those keep the flag. The copy is refreshed wherever the analysers used to see curr_experiment change in place (load, indexing settings, ROIs) and outlives the analysers. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK --- viewer/JFJochImageReadingWorker.cpp | 14 ++++++++++++-- viewer/JFJochImageReadingWorker.h | 5 +++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/viewer/JFJochImageReadingWorker.cpp b/viewer/JFJochImageReadingWorker.cpp index 55661f511..a6ae492b0 100644 --- a/viewer/JFJochImageReadingWorker.cpp +++ b/viewer/JFJochImageReadingWorker.cpp @@ -452,13 +452,21 @@ void JFJochImageReadingWorker::LoadImage(int64_t image_number, int64_t summation LoadImage_i(image_number, summation); } +void JFJochImageReadingWorker::UpdateAnalysisExperiment_i() { + analysis_experiment = curr_experiment; + auto settings = analysis_experiment.GetIndexingSettings(); + settings.RotationIndexing(false); + analysis_experiment.ImportIndexingSettings(settings); +} + void JFJochImageReadingWorker::UpdateAzint_i(const JFJochReaderDataset *dataset) { if (dataset) { + UpdateAnalysisExperiment_i(); azint_mapping = std::make_unique(curr_experiment, *dataset->pixel_mask); // Interactive/live analysis only needs the current image's result (returned per image); it // never scales the accumulated run, so don't retain the whole-run integration_outcome vector. - index_and_refine = std::make_unique(curr_experiment, indexing.get(), /*retain_outcomes=*/false); - image_analysis = std::make_unique(curr_experiment, *azint_mapping, *dataset->pixel_mask, + index_and_refine = std::make_unique(analysis_experiment, indexing.get(), /*retain_outcomes=*/false); + image_analysis = std::make_unique(analysis_experiment, *azint_mapping, *dataset->pixel_mask, *index_and_refine.get(), /*enable_fused_adaptive_gpu=*/true); last_profile_.reset(); @@ -694,6 +702,7 @@ void JFJochImageReadingWorker::UpdateSpotFindingSettings(const SpotFindingSettin logger.ErrorException(e); return; } + UpdateAnalysisExperiment_i(); if (auto_reanalyze) { ReanalyzeImage_i(); @@ -876,6 +885,7 @@ void JFJochImageReadingWorker::SetROIDefinition_i(const ROIDefinition &rois) { // edited ROIs override whatever the file carried. roi_override_ = rois; curr_experiment.ROI().SetROI(rois); + UpdateAnalysisExperiment_i(); if (image_analysis) image_analysis->RebuildROI(); diff --git a/viewer/JFJochImageReadingWorker.h b/viewer/JFJochImageReadingWorker.h index b2692bf2f..e0a76c053 100644 --- a/viewer/JFJochImageReadingWorker.h +++ b/viewer/JFJochImageReadingWorker.h @@ -116,6 +116,10 @@ private: QString current_file; DiffractionExperiment curr_experiment; + // What the interactive analysers below read (they hold a reference to it): curr_experiment with + // rotation indexing off, so every frame is indexed on its own, rotation or not. The rotation + // indexer wants the whole sweep, which only a processing job reads (from curr_experiment). + DiffractionExperiment analysis_experiment; // Once the user edits ROIs they override whatever the file carried, for this and // every subsequently loaded image, until a new file is opened. std::optional roi_override_; @@ -211,6 +215,7 @@ private: void ReanalyzeImage_i(); void UpdateDataset_i(const std::optional& experiment); void UpdateAzint_i(const JFJochReaderDataset *dataset); + void UpdateAnalysisExperiment_i(); void UpdateUserMask_i(const std::vector &mask); void SetROIDefinition_i(const ROIDefinition &rois); void ApplyROIOverrideToImage_i(); // rewrite current_image_ptr's dataset with roi_override_