// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include "../common/DetectorModules.h" #include "../common/DetectorOrientation.h" #include "../common/DiffractionGeometry.h" #include "HDF5Objects.h" // The detector's modules as NXmx describes them: one NXdetector_module group per module, // /entry/instrument/detector/module_, after the NeXus base class NXdetector_module // (https://manual.nexusformat.org/classes/base_classes/NXdetector_module.html) as NXmx uses it // (https://manual.nexusformat.org/classes/applications/NXmx.html): // - data_origin, data_size: where the module is in the image array, slowest index first ([row, column]); // - module_offset: translation from the image's pixel (0, 0) to the module's first pixel, depends_on // the detector's own translation (the sample -> pixel (0, 0) vector the master writes); // - fast_pixel_direction, slow_pixel_direction: translation of one pixel along the module's columns and // rows, depends_on module_offset. // Vectors are in the McStas frame, lengths in metres. A pixel (row i, column j) of a module is then at // translation + module_offset + j fast + i slow - the convention dxtbx reads. void WriteNXmxModules(HDF5Object &file, const DetectorModules &modules, double pixel_size_m, const DetectorOrientation &orientation, const std::string &depends_on); // A file holding only the module geometry (and the detector translation it hangs from), for // rugnux --module-geometry. void WriteModuleGeometryFile(const std::string &path, const DetectorModules &modules, const DiffractionGeometry &geom);