Hierarchical Data Format 5

Concept

The HDF5 file-architecture is composed of two trees: data and header (see Fig. 1). Both trees are accessed by opening the <*_master.h5> file. Data are written to HDF5 files using the NeXus standard. Header items are valid for all images of the data tree and are described in the NeXus section of this guide.

Ranges of consecutive images are saved in seperate data files. The data tree of the master file contains a link to each data file in the /entry/data/data_xxxxxx branch. To access a specific image, one has to first find the corresponding link, open it and then read the image. The example code illustrates how this is easily done by creating a lookup table (LUT) that links the image numbers to links to the data file containing the image.

Sample Code

Prerequisites:

Sample Code (includes C++, python code):

Installation

C++ compilation
h5c++ -O3 -o FileReaderExample FileReaderExample.cpp

or

g++ -O3 -o FileReaderExample FileReaderExample.cpp -lhdf5

Python
The python examples should run if the prerequisites are fulfilled.

Usage

C++
32bit example:
./FileReaderExample <master file> 0

16bit example:
./FileReaderExample <master file> 1

Python
h5py example:
./FileReaderExampleH5py.py <master file>

pytables example:
./FileReaderExamplePyTables.py <master file>

Remarks

Reading a header item in the NeXus format is straightforward in HDF5. See DNexusReadHelper.h or the python scripts for more details.

Reading an image is slightly more difficult. EIGER writes the images into several data files, each containing a large number of images. These datafiles are linked from the master file (see Fig. 1). To find image number n, one first creates a lookup table (LUT), mapping each image number to the link name pointing to the data file containing the image. See CreateLUT() in DNexusReadHelper.h, and ReadImage(), or the python scripts.

HDF5 and crystallographic software

Major crystallographic integration software packages are planning to support EIGER HDF5 data. The XDS package uses H5ToXds for processing of EIGER HDF5 data. H5ToXds is available for download below (64-bit Linux only).