mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 12:27:14 +02:00
hdf5 works
This commit is contained in:
@ -261,6 +261,7 @@ void HDF5DataFile::Convert12to16Bit(uint16_t *dst, uint8_t *src) {
|
|||||||
|
|
||||||
void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber,
|
void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber,
|
||||||
char *buffer) {
|
char *buffer) {
|
||||||
|
// expand 12 bit to 16 bits
|
||||||
char *revBuffer = buffer;
|
char *revBuffer = buffer;
|
||||||
if (dynamicRange_ == 12) {
|
if (dynamicRange_ == 12) {
|
||||||
revBuffer = (char *)malloc(EIGER_16_BIT_IMAGE_SIZE);
|
revBuffer = (char *)malloc(EIGER_16_BIT_IMAGE_SIZE);
|
||||||
@ -270,7 +271,6 @@ void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber,
|
|||||||
std::to_string(index_));
|
std::to_string(index_));
|
||||||
}
|
}
|
||||||
Convert12to16Bit((uint16_t *)revBuffer, (uint8_t *)buffer);
|
Convert12to16Bit((uint16_t *)revBuffer, (uint8_t *)buffer);
|
||||||
free(revBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(*hdf5Lib_);
|
std::lock_guard<std::mutex> lock(*hdf5Lib_);
|
||||||
@ -291,7 +291,13 @@ void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber,
|
|||||||
DataSpace memspace(2, dims2);
|
DataSpace memspace(2, dims2);
|
||||||
dataSet_->write(revBuffer, dataType_, memspace, *dataSpace_);
|
dataSet_->write(revBuffer, dataType_, memspace, *dataSpace_);
|
||||||
memspace.close();
|
memspace.close();
|
||||||
|
if (dynamicRange_ == 12) {
|
||||||
|
free(revBuffer);
|
||||||
|
}
|
||||||
} catch (const Exception &error) {
|
} catch (const Exception &error) {
|
||||||
|
if (dynamicRange_ == 12) {
|
||||||
|
free(revBuffer);
|
||||||
|
}
|
||||||
LOG(logERROR) << "Could not write to file in object " << index_;
|
LOG(logERROR) << "Could not write to file in object " << index_;
|
||||||
error.printErrorStack();
|
error.printErrorStack();
|
||||||
throw sls::RuntimeError("Could not write to file in object " +
|
throw sls::RuntimeError("Could not write to file in object " +
|
||||||
|
Reference in New Issue
Block a user