From 6b989b4213aa6e073966aafbeae01185eacb81cd Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Mon, 29 Jun 2026 22:41:37 +0200 Subject: [PATCH] reader: read sensor thickness/material from the HDF5 metadata HDF5MetadataSource ignored /entry/instrument/detector/sensor_thickness and sensor_material and left the DetectorSetup default (320 um, Si). Read them when present (NXmx stores thickness in metres), so reprocessing honours the recorded sensor -- which the parallax/absorption model needs. (The acquisition path still records the 320 um default because DetDECTRIS sets no per-model thickness; that is a separate, acquisition-side fix.) Co-Authored-By: Claude Opus 4.8 --- reader/HDF5MetadataSource.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reader/HDF5MetadataSource.cpp b/reader/HDF5MetadataSource.cpp index bde7cd52..2109d685 100644 --- a/reader/HDF5MetadataSource.cpp +++ b/reader/HDF5MetadataSource.cpp @@ -647,6 +647,12 @@ HDF5MetadataSource::OpenResult HDF5MetadataSource::Open(const std::string &filen DetectorSetup detector = DetDECTRIS(image_size_x, image_size_y, detector_name, {}); detector.PixelSize_um(master_file->GetFloat("/entry/instrument/detector/x_pixel_size") * 1e6); + // Sensor thickness/material drive the parallax/absorption model, so take them from the file + // rather than the DetectorSetup default (NXmx stores thickness in metres). + if (master_file->Exists("/entry/instrument/detector/sensor_thickness")) + detector.SensorThickness_um(master_file->GetFloat("/entry/instrument/detector/sensor_thickness") * 1e6); + if (master_file->Exists("/entry/instrument/detector/sensor_material")) + detector.SensorMaterial(master_file->GetString("/entry/instrument/detector/sensor_material")); detector.SaturationLimit(master_file->GetInt("/entry/instrument/detector/saturation_value")); detector.MinFrameTime(std::chrono::microseconds(0)); detector.MinCountTime(std::chrono::microseconds(0));