From 0503ef02716fd8ccc402115dd9c8e08bef397f86 Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Fri, 8 May 2026 20:06:41 +0200 Subject: [PATCH] jfjoch_process: Adapt behavior to write file with processing results and link to original images (to be tested) --- tools/jfjoch_process.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tools/jfjoch_process.cpp b/tools/jfjoch_process.cpp index a54d93a5..80cb813a 100644 --- a/tools/jfjoch_process.cpp +++ b/tools/jfjoch_process.cpp @@ -376,15 +376,6 @@ int main(int argc, char **argv) { start_message.write_images = write_output; start_message.file_format = FileWriterFormat::NXmxIntegrated; - std::unique_ptr writer; - try { - if (!output_prefix.empty()) - writer = std::make_unique(start_message); - } catch (const std::exception &e) { - logger.Error("Failed to initialize file writer: {}", e.what()); - exit(EXIT_FAILURE); - } - // 4. Processing Setup int total_images_in_file = reader.GetNumberOfImages(); if (end_image < 0 || end_image > total_images_in_file) @@ -405,6 +396,22 @@ int main(int argc, char **argv) { std::atomic total_uncompressed_bytes = 0; std::atomic max_image_number_sent = 0; + start_message.file_format = FileWriterFormat::NXmxIntegrated; + start_message.write_master_file = true; + start_message.write_images = false; + start_message.number_of_images = images_to_process; + start_message.images_per_file = images_to_process; + start_message.hdf5_source_data = reader.GetHDF5DataSource(start_image, images_to_process); + + std::unique_ptr writer; + try { + if (!output_prefix.empty()) + writer = std::make_unique(start_message); + } catch (const std::exception &e) { + logger.Error("Failed to initialize file writer: {}", e.what()); + exit(EXIT_FAILURE); + } + // Mimic JFJochReceiver lattice handling (IndexAndRefine handles the logic per thread, // but we need a central accumulator or use the pool's functionality if IndexAndRefine wraps it) // Here we will use per-thread IndexAndRefine which uses the shared thread pool.