rugnux: describe the linked images in _process.h5, not the processing container
_process.h5 is an NXmxIntegrated master that links to the ORIGINAL image files rather than writing images of its own (write_images = false). Its pixel metadata therefore has to describe those files - but it was filled from experiment_, which Rugnux pins to signed 32-bit because that is the container HDF5MetadataSource hands images out in. The virtual dataset was consequently typed int32 over unsigned 16- or 32-bit sources, so HDF5 converted every value on read: the 0xFFFFFFFF error marker of a uint32 source does not survive, and error_value and underload_value described a container the file does not contain. Our own reader never saw it, because it resolves the mapping and opens the source file itself. Only consumers that go through the virtual view - DIALS, XDS via Durin, plain h5py - read the converted values. Take the format from the reader instead. GetStoredPixelFormat() reports the bit depth and signedness of /entry/data/data as stored, which is deliberately not the same thing as the experiment's image format, and rugnux fills the start message from it. The writer is left alone on purpose: it must be able to produce a master before the mapped files exist, or when they are not readable, and the mapping strips the source directory, so it cannot open them to ask. Measured on a 20-image set with int16 sources: the _process.h5 virtual dataset goes from H5T_STD_I32LE to H5T_STD_I16LE, matching the source, and DIALS reports trusted_range (-32767, 32765) instead of (-2147483647, 32765). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,11 +14,22 @@
|
||||
// HDF5ImageLocator to find the file (with its open-file cache). This is the part whose "links
|
||||
// to files stay" constant: switching which master the per-image metadata is read from never
|
||||
// touches it. Caller must hold the global hdf5_mutex (HDF5 is not thread-safe).
|
||||
// Bit depth and signedness of /entry/data/data as it is STORED. Deliberately not the same thing as
|
||||
// the experiment's image format: the reader hands every image out in a signed 32-bit container
|
||||
// whatever the file holds (see HDF5MetadataSource), so an output file that links to the original
|
||||
// images rather than writing its own must describe them with this, not with the experiment.
|
||||
struct StoredPixelFormat {
|
||||
int64_t bit_depth = 0;
|
||||
bool is_signed = false;
|
||||
};
|
||||
|
||||
class HDF5ImageSource {
|
||||
public:
|
||||
void Configure(HDF5ImageLocator::Layout layout);
|
||||
void Clear();
|
||||
|
||||
[[nodiscard]] StoredPixelFormat GetStoredPixelFormat() const;
|
||||
|
||||
// Where image `global` physically lives. Also used by the metadata source to find the data
|
||||
// file that holds a legacy/VDS image's per-image metadata.
|
||||
HDF5ImageLocator::Location Resolve(int64_t global) const;
|
||||
|
||||
Reference in New Issue
Block a user