74 lines
2.1 KiB
C++
74 lines
2.1 KiB
C++
// Copyright (2019-2022) Paul Scherrer Institute
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#ifndef HDF5DATAFILE_H
|
|
#define HDF5DATAFILE_H
|
|
|
|
#include <queue>
|
|
#include <string>
|
|
#include <chrono>
|
|
|
|
#include "HDF5Objects.h"
|
|
#include "../common/SpotToSave.h"
|
|
#include "../frame_serialize/ImageMessage.h"
|
|
|
|
struct HDF5DataFileStatistics {
|
|
std::string filename;
|
|
uint64_t max_image_number;
|
|
uint64_t total_images;
|
|
};
|
|
|
|
class HDF5DataFile {
|
|
std::string filename;
|
|
|
|
std::unique_ptr<HDF5File> data_file = nullptr;
|
|
std::unique_ptr<HDF5DataSet> data_set = nullptr;
|
|
std::unique_ptr<HDF5DataSet> data_set_spot_x = nullptr;
|
|
std::unique_ptr<HDF5DataSet> data_set_spot_y = nullptr;
|
|
std::unique_ptr<HDF5DataSet> data_set_spot_int = nullptr;
|
|
std::unique_ptr<HDF5DataSet> data_set_spot_indexed = nullptr;
|
|
|
|
std::unique_ptr<HDF5Group> result_group = nullptr;
|
|
std::unique_ptr<HDF5Group> rad_int_group = nullptr;
|
|
|
|
size_t xpixel;
|
|
size_t ypixel;
|
|
size_t max_image_number;
|
|
size_t nimages;
|
|
|
|
HDF5Dcpl dcpl;
|
|
HDF5DataType data_type;
|
|
std::string image_units;
|
|
|
|
std::vector<uint64_t> bunch_id;
|
|
std::vector<uint32_t> jf_info;
|
|
std::vector<uint64_t> timestamp;
|
|
std::vector<uint32_t> storage_cell;
|
|
std::vector<uint32_t> exptime;
|
|
std::vector<float> receiver_available_send_buffers;
|
|
std::vector<int64_t> receiver_aq_dev_delay;
|
|
|
|
std::vector<float> rad_int_bin_to_q;
|
|
std::vector<float> rad_int_file_avg;
|
|
std::vector<float> indexing_lattice;
|
|
|
|
std::vector<uint32_t> spot_count;
|
|
const size_t max_spots;
|
|
|
|
std::vector<uint8_t> indexing_result;
|
|
|
|
void CreateFile();
|
|
public:
|
|
HDF5DataFile(const std::string& name, int64_t width, int64_t height, int64_t pixel_depth_byte,
|
|
bool is_signed, const std::vector<float>& rad_int_bin_to_q,
|
|
CompressionAlgorithm compression = CompressionAlgorithm::BSHUF_LZ4,
|
|
size_t max_spots = 0);
|
|
~HDF5DataFile();
|
|
|
|
void Write(const DataMessage& msg, uint64_t image_number);
|
|
HDF5DataFileStatistics GetStatistics() const;
|
|
size_t GetNumImages() const;
|
|
};
|
|
|
|
#endif //HDF5DATAFILE_H
|