cryio
cryio is a C++ library for reading, writing and manipulating diffraction detector frames used at synchrotron beamlines. It is part of the Pylatus meta-package and is used by Pylatus, crymon and other components of the SNBL software stack.
The library provides a common CryioFrame base class and a set of format-specific frame classes with a unified API for
image data, headers and metadata. It also includes parsers for calibration files .poni and .par, beam center
handling and Crysalis run file generation.
Supported formats
Frame readers/writers implemented in cryio/cryio:
- CBF / CBF header -
cryio/cbfframe.h- Compressed Binary File, Dectris Pilatus/Eiger/Jungfrau - extensions: .cbf - EDF -
cryio/edfframe.h- extensions: .edf, .azim - MAR345 / MAR -
cryio/marframe.h+cryio/mar345.h/c- extensions: .mar2300, .mar3450, .mar2560 - Bruker Gfrm -
cryio/brukerframe.h- extensions: .gfrm - TIFF -
cryio/tifframe.h- extensions: .tif, .tiff - Esperanto -
cryio/esperantoframe.h- extensions: .esp, .esperanto - OXD -
cryio/oxdframe.h- extensions: .img - Raxis STL -
cryio/raxis.h- extensions: .stl - Fit2D mask -
cryio/fit2dmaskframe.h- extensions: .msk - HDF5 based:
- Eiger -
cryio/eigerframe.h- extensions: .h5, .hdf5 - Jungfrau -
cryio/jungfrauframe.h- extensions: .h5, .hdf5 - PyFAI -
cryio/pyfaiframe.h- extensions: .h5, .hdf5 - generic HDF5 -
cryio/hdf5frame.h- extensions: .h5, .hdf5
- Eiger -
- Multi-frame -
cryio/multiframe.h
Cryio::openFrame tries formats in the order CBF, EDF, MAR, Bruker, TIFF, Esperanto, OXD, Raxis, Fit2DMask, Jungfrau,
Eiger, PyFAI.
Core components
cryio/cryioframe.h- base classCryioFramederived fromSiFrame<double>, from llr. Provides pixel size, exposure, angles omega/phi/kappa/theta, beam centre, wavelength, distance, header storage, endian conversion, smart append and multiframe navigation.cryio/cryio.h-Cryio::open<T>,Cryio::openFrame, extension list helpers andCryio::Pilatusdimension utilities.cryio/crysalis.h- Crysalis run file creation,.parfile generation and auxiliary files for Dectris detectors.cryio/parparser.h- parser for.parcalibration files.cryio/poniparser.h- parser for PyFAI.ponifiles, with Nexus HDF5 support.cryio/beamcenter.h- beam centre extraction from CBF headers.cryio/detectors.h- detector id tables and default pixel sizes for Pilatus, Eiger, Frelon, Maxipix, Mythen, Quantum, Hf, IMxpad, Fairchild, Titan, Basler, Perkin, Pixium.
Templates for Crysalis settings in templates/.
Build
cryio uses CMake 3.27+, C++17.
Dependencies managed via cmake-tools:
- Qt5/6 Core
- llr - low level array and endian utilities
- HDF5 1.14
- bitshuffle 0.5.2, zstd
- TIFF v4.7.1
CMake options:
NO_AVX- disable AVX/AVX2 code pathsCRYIO_BUILD_TESTS- build GoogleTest suite intests/CRYIO_BUILD_BENCHES- build benchmarks and conversion utilities
Typical build:
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j
The library is built as a set of static targets:
cryio_basic, cryio_multi, cryio_cbf, cryio_oxd, cryio_edf, cryio_mar, cryio_bruker,
cryio_fit2dmask, cryio_esperanto, cryio_tiff, cryio_hdf5, cryio_eiger, cryio_jungfrau,
cryio_pyfai, cryio_raxis, cryio_par, cryio_poni, cryio_beamcenter, cryio_frames.
Tests
tests/ contains GoogleTest based tests using test data downloaded via tests/tests.cmake. Tests cover CBF, EDF, MAR,
Bruker, Fit2D mask, Eiger, PyFAI, TIFF, Esperanto, OXD, Raxis, Poni parser and save/load roundtrips.
Enable with -DCRYIO_BUILD_TESTS=ON.
Repository
Submodule of Pylatus meta-repo.
URL: https://git.3lp.cx/dyadkin/cryio
Parent: https://git.3lp.cx/dyadkin/pylatus
License
GPL-3.0+