version 1.0.0-rc.24
This commit is contained in:
32
writer/HDF5DataFilePluginROI.cpp
Normal file
32
writer/HDF5DataFilePluginROI.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright (2019-2024) Paul Scherrer Institute
|
||||
|
||||
#include "HDF5DataFilePluginROI.h"
|
||||
|
||||
#define RESERVE_IMAGES 1000
|
||||
|
||||
void HDF5DataFilePluginROI::OpenFile(HDF5File &data_file, const DataMessage &msg) {}
|
||||
|
||||
void HDF5DataFilePluginROI::Write(const DataMessage &msg, uint64_t image_number) {
|
||||
for (const auto &r: msg.roi) {
|
||||
if (roi_data.find(r.first) != roi_data.end()) {
|
||||
roi_data[r.first].max.reserve(RESERVE_IMAGES);
|
||||
roi_data[r.first].sum.reserve(RESERVE_IMAGES);
|
||||
}
|
||||
roi_data[r.first].max[image_number] = r.second.max_count;
|
||||
roi_data[r.first].sum[image_number] = r.second.sum;
|
||||
}
|
||||
}
|
||||
|
||||
void HDF5DataFilePluginROI::WriteFinal(HDF5File &data_file) {
|
||||
if (roi_data.empty())
|
||||
return;
|
||||
|
||||
HDF5Group group(data_file, "/entry/roi");
|
||||
group.NXClass("NXcollection");
|
||||
|
||||
for (const auto &r: roi_data) {
|
||||
HDF5Group group_roi(data_file, "/entry/roi/" + r.first);
|
||||
group.SaveVector("max", r.second.max.vec());
|
||||
group.SaveVector("sum", r.second.sum.vec());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user