mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 22:07:12 +02:00
r_framesperfile configurable to have infinite frames in file with option 0
This commit is contained in:
@ -95,7 +95,10 @@ int HDF5File::CreateFile(uint64_t fnum) {
|
||||
|
||||
//first time
|
||||
if(!fnum) UpdateDataType();
|
||||
uint64_t framestosave = ((*numImages - fnum) > (*maxFramesPerFile)) ? (*maxFramesPerFile) : (*numImages-fnum);
|
||||
|
||||
uint64_t framestosave = ((*maxFramesPerFile == 0) ? *numImages : // infinite images
|
||||
(((*numImages - fnum) > (*maxFramesPerFile)) ? // save up to maximum at a time
|
||||
(*maxFramesPerFile) : (*numImages-fnum)));
|
||||
pthread_mutex_lock(&Mutex);
|
||||
if (HDF5FileStatic::CreateDataFile(index, *overWriteEnable, currentFileName, (*numImages > 1),
|
||||
fnum, framestosave, nPixelsY, ((*dynamicRange==4) ? (nPixelsX/2) : nPixelsX),
|
||||
@ -136,7 +139,8 @@ void HDF5File::CloseAllFiles() {
|
||||
|
||||
|
||||
int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t nump) {
|
||||
if (numFramesInFile >= (*maxFramesPerFile)) {
|
||||
// check if maxframesperfile = 0 for infinite
|
||||
if ((*maxFramesPerFile) && (numFramesInFile >= (*maxFramesPerFile))) {
|
||||
CloseCurrentFile();
|
||||
CreateFile(fnum);
|
||||
}
|
||||
@ -144,12 +148,15 @@ int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t
|
||||
numActualPacketsInFile += nump;
|
||||
pthread_mutex_lock(&Mutex);
|
||||
if (HDF5FileStatic::WriteDataFile(index, buffer + sizeof(sls_detector_header),
|
||||
fnum%(*maxFramesPerFile), nPixelsY, ((*dynamicRange==4) ? (nPixelsX/2) : nPixelsX),
|
||||
// infinite then no need for %maxframesperfile
|
||||
((*maxFramesPerFile == 0) ? fnum : fnum%(*maxFramesPerFile)),
|
||||
nPixelsY, ((*dynamicRange==4) ? (nPixelsX/2) : nPixelsX),
|
||||
dataspace, dataset, datatype) == OK) {
|
||||
sls_detector_header* header = (sls_detector_header*) (buffer);
|
||||
/*header->xCoord = ((*detIndex) * (*numUnitsPerDetector) + index); */
|
||||
if (HDF5FileStatic::WriteParameterDatasets(index, dataspace_para,
|
||||
fnum%(*maxFramesPerFile),
|
||||
// infinite then no need for %maxframesperfile
|
||||
((*maxFramesPerFile == 0) ? fnum : fnum%(*maxFramesPerFile)),
|
||||
dataset_para, header) == OK) {
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
return OK;
|
||||
@ -218,7 +225,9 @@ int HDF5File::CreateVirtualFile(uint64_t numf) {
|
||||
virtualfd, masterFileName,
|
||||
filePath, fileNamePrefix, *fileIndex, (*numImages > 1),
|
||||
*detIndex, *numUnitsPerDetector,
|
||||
*maxFramesPerFile, numf+1,
|
||||
// infinite images in 1 file, then maxfrperfile = numf
|
||||
((*maxFramesPerFile == 0) ? numf+1 : *maxFramesPerFile),
|
||||
numf+1,
|
||||
"data", datatype,
|
||||
numDetY, numDetX, nPixelsY, ((*dynamicRange==4) ? (nPixelsX/2) : nPixelsX),
|
||||
HDF5_WRITER_VERSION);
|
||||
|
Reference in New Issue
Block a user