add vs code and rhel 8

This commit is contained in:
vhinger182 2024-09-02 12:00:12 +02:00
parent 4ae2edf686
commit a9c366890b
4 changed files with 169 additions and 324 deletions

View File

@ -34,7 +34,7 @@ void HDF5File::InitializeParameters () {
} }
int HDF5File::OpenResources (const char* const fname, bool validate) { int HDF5File::OpenResources (char const*const fname, bool validate) {
// Initialize // Initialize
//InitializeParameters(); //InitializeParameters();
@ -156,7 +156,7 @@ int HDF5File::OpenResources (const char* const fname, bool validate) {
H5Pclose (cparms); H5Pclose (cparms);
// allocate chunk memory // allocate chunk memory
current_image = new uint16_t[chunk_dims[Z]*DEFAULT_CHUNK_Y_DIMS*DEFAULT_CHUNK_X_DIMS]; //current_image = new uint16_t[chunk_dims[Z]*DEFAULT_CHUNK_Y_DIMS*DEFAULT_CHUNK_X_DIMS];
//current_image = new uint16_t[DEFAULT_X_DIMS*DEFAULT_Y_DIMS]; //current_image = new uint16_t[DEFAULT_X_DIMS*DEFAULT_Y_DIMS];
// Define memory space // Define memory space

View File

@ -256,6 +256,7 @@ class jungfrauLGADStrixelsDataQuadH5 : public slsDetectorData<uint16_t> {
//Mark overwritten functions as override final //Mark overwritten functions as override final
char* readNextFrame( std::ifstream &filebin ) override final {return nullptr;} char* readNextFrame( std::ifstream &filebin ) override final {return nullptr;}
public: public:
using header = sls::defs::sls_receiver_header; using header = sls::defs::sls_receiver_header;

View File

@ -44,7 +44,7 @@ list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxQuad)
if (SLS_USE_HDF5) if (SLS_USE_HDF5)
if (HDF5_FOUND) if (HDF5_FOUND)
add_executable(jungfrauRawDataProcessStrxQuadH5 jungfrauRawDataProcess_filetxtH5.cpp) add_executable(jungfrauRawDataProcessStrxQuadH5 jungfrauRawDataProcess_filetxtH5.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxQuadH5 PRIVATE JFSTRXQH5) #target_compile_definitions(jungfrauRawDataProcessStrxQuadH5 PRIVATE JFSTRXQH5)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxQuadH5) list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxQuadH5)
target_include_directories(jungfrauRawDataProcessStrxQuadH5 PRIVATE ${HDF5_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include) target_include_directories(jungfrauRawDataProcessStrxQuadH5 PRIVATE ${HDF5_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include)
target_link_libraries(jungfrauRawDataProcessStrxQuadH5 PRIVATE ${HDF5_LIBRARIES}) target_link_libraries(jungfrauRawDataProcessStrxQuadH5 PRIVATE ${HDF5_LIBRARIES})

View File

@ -10,35 +10,8 @@
#define RAWDATA #define RAWDATA
#if !defined JFSTRX && !defined JFSTRXQ && !defined JFSTRXQH5 && !defined JFSTRXOLD && !defined JFSTRXCHIP1 && \
!defined JFSTRXCHIP6 && !defined CHIP
#ifndef MODULE
#include "jungfrauHighZSingleChipData.h"
#endif
#ifdef MODULE
#include "jungfrauModuleData.h"
#endif
#endif
#ifdef CHIP
#include "jungfrauSingleChipData.h"
#endif
#ifdef JFSTRX
#include "jungfrauLGADStrixelsData_new.h"
#endif
#ifdef JFSTRXQ
#include "jungfrauLGADStrixelsDataQuad.h"
#endif
#ifdef JFSTRXQH5
#include "jungfrauLGADStrixelsDataQuadH5.h" #include "jungfrauLGADStrixelsDataQuadH5.h"
#endif
#if defined JFSTRXCHIP1 || defined JFSTRXCHIP6
#include "jungfrauLGADStrixelsDataSingleChip.h"
#endif
#ifdef JFSTRXOLD
#include "jungfrauStrixelsHalfModuleOldDesign.h"
#endif
#include "multiThreadedCountingDetector.h" #include "multiThreadedCountingDetector.h"
#include "singlePhotonDetector.h" #include "singlePhotonDetector.h"
@ -51,11 +24,13 @@
#include <ctime> #include <ctime>
#include <fmt/core.h> #include <fmt/core.h>
/*
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using json = nlohmann::json; using json = nlohmann::json;
*/
std::string getRootString( const std::string& filepath ) { std::string getRootString( std::string const& filepath ) {
size_t pos1; size_t pos1;
if (filepath.find("/") == std::string::npos ) if (filepath.find("/") == std::string::npos )
pos1 = 0; pos1 = 0;
@ -71,7 +46,8 @@ std::string getRootString( const std::string& filepath ) {
// fprefix: fileprefix (without extension) // fprefix: fileprefix (without extension)
// fsuffix: filesuffix (for output files, e.g. "ped") // fsuffix: filesuffix (for output files, e.g. "ped")
// fext: file extension (e.g. "raw") // fext: file extension (e.g. "raw")
std::string createFileName( const std::string& dir, const std::string& fprefix="run", const std::string& fsuffix="", const std::string& fext="raw", int outfilecounter=-1 ) { std::string createFileName( std::string const& dir, std::string const& fprefix="run",
std::string const& fsuffix="", std::string const& fext="raw", int const outfilecounter=-1 ) {
if (outfilecounter >= 0) if (outfilecounter >= 0)
return fmt::format("{:s}/{:s}_{:s}_f{:05d}.{:s}", dir, fprefix, fsuffix, outfilecounter, fext); return fmt::format("{:s}/{:s}_{:s}_f{:05d}.{:s}", dir, fprefix, fsuffix, outfilecounter, fext);
else if (fsuffix.length()!=0) else if (fsuffix.length()!=0)
@ -84,11 +60,11 @@ std::string createFileName( const std::string& dir, const std::string& fprefix="
//NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS! //NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS!
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < 11) { if (argc < 4) {
std::cout std::cout
<< "Usage is " << argv[0] << "Usage is " << argv[0]
<< " filestxt outdir [json master] [pedfile (raw or tiff)] [xmin xmax ymin ymax] " << " filestxt outdir [pedfile (h5)] optional: [bool validate h5 rank] "
"[threshold] [nframes] [optional: bool read rxroi from data file header]" "[xmin xmax ymin ymax] [threshold] [nframes] "
"NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS! " "NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS! "
<< std::endl; << std::endl;
std::cout std::cout
@ -102,35 +78,30 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
int fifosize = 1000; int const fifosize = 1000;
int nthreads = 10; int const nthreads = 10;
int csize = 3; // 3 int const csize = 3; // 3
int nsigma = 5; int const nsigma = 5;
int nped = 10000; int const nped = 10000;
int cf = 0; int cf = 0;
double *gainmap = NULL; std::string const txtfilename(argv[1]);
// float *gm; std::string const outdir(argv[2]);
std::string const pedfilename(argv[3]);
//int ff, np; bool validate_rank=true;
// cout << " data size is " << dsize; if (argc > 4)
validate_rank = atoi(argv[4]);
const std::string txtfilename(argv[1]);
const std::string outdir(argv[2]);
const std::string jsonmastername(argv[3]);
const std::string pedfilename(argv[4]);
double thr = 0; double thr = 0;
double thr1 = 1; double thr1 = 1;
thr = atof(argv[9]); if (argc > 8)
thr = atof(argv[8]);
int nframes = 0; int nframes = 0;
nframes = atoi(argv[10]); if (argc > 9)
nframes = atoi(argv[9]);
bool readrxroifromdatafile = false;
if (argc > 11)
readrxroifromdatafile = atoi(argv[11]);
//Get vector of filenames from input txt-file //Get vector of filenames from input txt-file
std::vector<std::string> filenames{}; std::vector<std::string> filenames{};
@ -160,154 +131,25 @@ int main(int argc, char *argv[]) {
std::cout << "###############" << std::endl; std::cout << "###############" << std::endl;
// Receiver ROI // Define decoder
uint16_t rxroi_xmin = 0;
uint16_t rxroi_xmax = 0;
uint16_t rxroi_ymin = 0;
uint16_t rxroi_ymax = 0;
{ //protective scope so ifstream gets destroyed properly
std::ifstream masterfile(jsonmastername); //, ios::in | ios::binary);
if (masterfile.is_open()) {
json j;
masterfile >> j;
rxroi_xmin = j["Receiver Roi"]["xmin"];
rxroi_xmax = j["Receiver Roi"]["xmax"];
rxroi_ymin = j["Receiver Roi"]["ymin"];
rxroi_ymax = j["Receiver Roi"]["ymax"];
masterfile.close();
std::cout << "Read rxROI [" << rxroi_xmin << ", " << rxroi_xmax << ", "
<< rxroi_ymin << ", " << rxroi_ymax << "]" << std::endl;
} else
std::cout << "Could not open master file " << jsonmastername << std::endl;
}
// Define decoders...
#if !defined JFSTRX && !defined JFSTRXQ && !defined JFSTRXQH5 && !defined JFSTRXOLD && !defined JFSTRXCHIP1 && \
!defined JFSTRXCHIP6 && !defined CHIP
#ifndef MODULE
jungfrauHighZSingleChipData *decoder = new jungfrauHighZSingleChipData();
int nx = 256, ny = 256;
#endif
#ifdef MODULE
jungfrauModuleData *decoder = new jungfrauModuleData();
int nx = 1024, ny = 512;
#endif
#endif
#ifdef CHIP
std::cout << "Jungfrau pixel module single chip readout" << std::endl;
jungfrauSingleChipData *decoder = new jungfrauSingleChipData();
int nx = 256, ny = 256;
#endif
#ifdef JFSTRX
std::cout << "Jungfrau strixel full module readout" << std::endl;
#ifndef ALDO
if (readrxroifromdatafile)
{ //THIS SCOPE IS IMPORTANT! (To ensure proper destruction of ifstream)
using header = sls::defs::sls_receiver_header;
// check if there is a roi in the header
typedef struct {
uint16_t xmin;
uint16_t xmax;
uint16_t ymin;
uint16_t ymax;
} receiverRoi_compact;
receiverRoi_compact croi;
//std::string filepath(argv[9]); //This is a problem if the input files have different ROIs!
std::cout << "Reading header of file " << filenames[0] << " to check for ROI "
<< std::endl;
std::ifstream firstfile( filenames[0], ios::in | ios::binary);
if (firstfile.is_open()) {
header hbuffer;
std::cout << "sizeof(header) = " << sizeof(header) << std::endl;
if (firstfile.read((char *)&hbuffer, sizeof(header))) {
memcpy(&croi, &hbuffer.detHeader.detSpec1, 8);
std::cout << "Read ROI [" << croi.xmin << ", " << croi.xmax << ", "
<< croi.ymin << ", " << croi.ymax << "]" << std::endl;
rxroi_xmin = croi.xmin;
rxroi_xmax = croi.xmax;
rxroi_ymin = croi.ymin;
rxroi_ymax = croi.ymax;
} else
std::cout << "reading error" << std::endl;
firstfile.close();
} else
std::cout << "Could not open " << filenames[0] << " for reading " << std::endl;
} //end of protective scope
#endif
jungfrauLGADStrixelsData *decoder =
new jungfrauLGADStrixelsData(rxroi_xmin, rxroi_xmax, rxroi_ymin, rxroi_ymax);
int nx = 1024 / 3, ny = 512 * 5;
#endif
#ifdef JFSTRXQ
std::cout << "Jungfrau strixel quad" << std::endl;
jungfrauLGADStrixelsDataQuad *decoder =
new jungfrauLGADStrixelsDataQuad(rxroi_xmin, rxroi_xmax, rxroi_ymin, rxroi_ymax);
int nx = 1024 / 3, ny = 512 * 3;
#endif
#ifdef JFSTRXQH5
std::cout << "Jungfrau strixel quad h5" << std::endl; std::cout << "Jungfrau strixel quad h5" << std::endl;
jungfrauLGADStrixelsDataQuadH5 *decoder = //jungfrauLGADStrixelsDataQuadH5* decoder = new jungfrauLGADStrixelsDataQuadH5();
new jungfrauLGADStrixelsDataQuadH5(rxroi_xmin, rxroi_xmax, rxroi_ymin, rxroi_ymax); auto decoder = std::make_unique<jungfrauLGADStrixelsDataQuadH5>();
int nx = 1024 / 3, ny = 512 * 3; int nx = 1024 / 3, ny = 512 * 3;
#endif
#ifdef JFSTRXCHIP1
std::cout << "Jungfrau strixel LGAD single chip 1" << std::endl;
jungfrauLGADStrixelsDataSingleChip *decoder =
new jungfrauLGADStrixelsDataSingleChip(1);
int nx = 256 / 3, ny = 256 * 5;
#endif
#ifdef JFSTRXCHIP6
std::cout << "Jungfrau strixel LGAD single chip 6" << std::endl;
jungfrauLGADStrixelsDataSingleChip *decoder =
new jungfrauLGADStrixelsDataSingleChip(6);
int nx = 256 / 3, ny = 256 * 5;
#endif
#ifdef JFSTRXOLD
std::cout << "Jungfrau strixels old design" << std::endl;
jungfrauStrixelsHalfModuleOldDesign *decoder =
new jungfrauStrixelsHalfModuleOldDesign();
int nx = 1024 * 3, ny = 512 / 3;
#endif
decoder->getDetectorSize(nx, ny);
std::cout << "Detector size is " << nx << " " << ny << std::endl;
//Cluster finder ROI //Cluster finder ROI
int xmin = 0, xmax = nx-1, ymin = 0, ymax = ny-1; int xmin = 0, xmax = nx-1, ymin = 0, ymax = ny-1;
if (argc > 8) {
xmin = atoi(argv[5]); xmin = atoi(argv[5]);
xmax = atoi(argv[6]); xmax = atoi(argv[6]);
ymin = atoi(argv[7]); ymin = atoi(argv[7]);
ymax = atoi(argv[8]); ymax = atoi(argv[8]);
}
std::cout << "Cluster finder ROI: [" << xmin << ", " << xmax << ", " << ymin << ", " << ymax << "]" std::cout << "Cluster finder ROI: [" << xmin << ", " << xmax << ", " << ymin << ", " << ymax << "]"
<< std::endl; << std::endl;
/* old decoder->getDetectorSize(nx, ny);
if ( xmin == xmax ) { std::cout << "Detector size is " << nx << " " << ny << std::endl;
xmin = 0;
xmax = nx;
}
if ( ymin == ymax ) {
ymin = 0;
ymax = ny;
}
std::cout << xmin << " " << xmax << " " << ymin << " " << ymax << " "
<< std::endl;
*/
/*
char *gainfname = NULL;
if (argc > 14) {
gainfname = argv[14];
std::cout << "Gain map file name is: " << gainfname << std::endl;
}
*/
std::time_t end_time; std::time_t end_time;
@ -320,18 +162,10 @@ int main(int argc, char *argv[]) {
uint32_t nnx, nny; uint32_t nnx, nny;
singlePhotonDetector *filter = new singlePhotonDetector( //singlePhotonDetector* filter =
decoder, 3, nsigma, 1, NULL, nped, 200, -1, -1, gainmap, NULL); // new singlePhotonDetector(decoder.get(), 3, nsigma, 1, NULL, nped, 200, -1, -1, NULL, NULL);
auto filter = std::make_unique<singlePhotonDetector>(decoder.get(), 3, nsigma, 1, nullptr, nped, 200, -1, -1, nullptr, nullptr);
/*
if (gainfname) {
if (filter->readGainMap(gainfname))
std::cout << "using gain map " << gainfname << std::endl;
else
std::cout << "Could not open gain map " << gainfname << std::endl;
} else
*/
thr = 0.15 * thr; thr = 0.15 * thr;
filter->newDataSet(); filter->newDataSet();
// int dsize = decoder->getDataSize(); // int dsize = decoder->getDataSize();
@ -350,8 +184,9 @@ int main(int argc, char *argv[]) {
char* buff; char* buff;
multiThreadedCountingDetector *mt = //multiThreadedCountingDetector* mt =
new multiThreadedCountingDetector(filter, nthreads, fifosize); // new multiThreadedCountingDetector(filter, nthreads, fifosize);
auto mt = std::make_unique<multiThreadedCountingDetector>(filter.get(), nthreads, fifosize);
mt->setClusterSize(csize, csize); mt->setClusterSize(csize, csize);
#ifndef ANALOG #ifndef ANALOG
@ -373,8 +208,6 @@ int main(int argc, char *argv[]) {
mt->StartThreads(); mt->StartThreads();
mt->popFree(buff); mt->popFree(buff);
// cout << "mt " << endl;
int ifr = 0; //frame counter of while loop int ifr = 0; //frame counter of while loop
int framenumber = -1; //framenumber as read from file (detector) int framenumber = -1; //framenumber as read from file (detector)
int iframe = 0; //frame counter internal to HDF5File::ReadImage (provided for sanity check/debugging) int iframe = 0; //frame counter internal to HDF5File::ReadImage (provided for sanity check/debugging)
@ -385,25 +218,24 @@ int main(int argc, char *argv[]) {
std::cout << "PEDESTAL " << std::endl; std::cout << "PEDESTAL " << std::endl;
if (pedfilename.find(".tif") == std::string::npos) { if (pedfilename.find(".tif") == std::string::npos) { //not a tiff file
const std::string fname(pedfilename); std::string const fname(pedfilename);
std::cout << fname << std::endl; std::cout << fname << std::endl;
std::time(&end_time); std::time(&end_time);
std::cout << "aaa " << std::ctime(&end_time) << std::endl; std::cout << "aaa " << std::ctime(&end_time) << std::endl;
mt->setFrameMode(ePedestal); mt->setFrameMode(ePedestal);
//std::ifstream pedefile(fname, ios::in | ios::binary); //HDF5File pedefile;
HDF5File pedefile; auto pedefile = std::make_unique<HDF5File>();
// //open file // //open file
if ( pedefile.OpenResources(fname.c_str(),1) ) { if ( pedefile->OpenResources(fname.c_str(),validate_rank) ) {
std::cout << "bbbb " << std::ctime(&end_time) << std::endl; std::cout << "bbbb " << std::ctime(&end_time) << std::endl;
framenumber = -1; framenumber = -1;
while ( decoder->readNextFrame(pedefile, framenumber, iframe, buff) ) { while ( decoder->readNextFrame(*pedefile, framenumber, iframe, buff) ) {
// if (np == 40) {
if ((ifr + 1) % 100 == 0) { if ((ifr + 1) % 100 == 0) {
std::cout std::cout
<< " ****" << " ****"
@ -417,13 +249,13 @@ int main(int argc, char *argv[]) {
std::cout << " ****" << ifr << " " << framenumber << " " << iframe std::cout << " ****" << ifr << " " << framenumber << " " << iframe
<< std::endl; << std::endl;
} // else } // else
//std::cout << ifr << " " << ff << " " << np << std::endl;
if (ifr >= 1000) if (ifr >= 1000)
break; break;
framenumber = -1; framenumber = -1;
} }
//pedefile.close();
pedefile.CloseResources(); pedefile->CloseResources();
while (mt->isBusy()) { while (mt->isBusy()) {
; ;
} }
@ -437,7 +269,9 @@ int main(int argc, char *argv[]) {
} else } else
std::cout << "Could not open pedestal file " << fname std::cout << "Could not open pedestal file " << fname
<< " for reading " << std::endl; << " for reading " << std::endl;
} else {
} else { //is a tiff file
std::vector<double> ped(nx * ny); std::vector<double> ped(nx * ny);
float* pp = ReadFromTiff(pedfilename.c_str(), nny, nnx); float* pp = ReadFromTiff(pedfilename.c_str(), nny, nnx);
if (pp && (int)nnx == nx && (int)nny == ny) { if (pp && (int)nnx == nx && (int)nny == ny) {
@ -462,60 +296,67 @@ int main(int argc, char *argv[]) {
mt->setFrameMode(eFrame); mt->setFrameMode(eFrame);
FILE *of = NULL; FILE* of = nullptr;
std::ifstream filebin{};
//NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS! //NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS!
for (unsigned int ifile = 0; ifile != filenames.size(); ++ifile) { for (unsigned int ifile = 0; ifile != filenames.size(); ++ifile) {
std::cout << "DATA "; std::cout << "DATA ";
std::string fsuffix{}; std::string fsuffix{};
const std::string fprefix( getRootString(filenames[ifile]) ); std::string const fprefix( getRootString(filenames[ifile]) );
std::string imgfname( createFileName( outdir, fprefix, fsuffix, "tiff" ) ); std::string imgfname( createFileName( outdir, fprefix, fsuffix, "tiff" ) );
const std::string cfname( createFileName( outdir, fprefix, fsuffix, "clust" ) ); std::string const cfname( createFileName( outdir, fprefix, fsuffix, "clust" ) );
std::cout << filenames[ifile] << " "; std::cout << filenames[ifile] << " ";
std::cout << imgfname << std::endl; std::cout << imgfname << std::endl;
std::time(&end_time); std::time(&end_time);
std::cout << std::ctime(&end_time) << std::endl; std::cout << std::ctime(&end_time) << std::endl;
//std::ifstream filebin(filenames[ifile], ios::in | ios::binary); //HDF5File fileh5;
HDF5File fileh5; auto fileh5 = std::make_unique<HDF5File>();
// //open file // //open file
ioutfile = 0; ioutfile = 0;
if ( fileh5.OpenResources(filenames[ifile].c_str(), 1) ) { if ( fileh5->OpenResources(filenames[ifile].c_str(), validate_rank) ) {
if (thr <= 0 && cf != 0) { // cluster finder if (thr <= 0 && cf != 0) { // cluster finder
if (of == NULL) { if (of == nullptr) {
of = fopen(cfname.c_str(), "w"); of = fopen(cfname.c_str(), "w");
if (of) { if (of) {
if (mt) {
mt->setFilePointer(of); mt->setFilePointer(of);
std::cout << "file pointer set " << std::endl; std::cout << "file pointer set " << std::endl;
} else {
std::cerr << "Error: mt is null." << std::endl;
return 1;
}
//mt->setFilePointer(of);
//std::cout << "file pointer set " << std::endl;
std::cout << "Here! " << framenumber << " ";
} else { } else {
std::cout << "Could not open " << cfname std::cout << "Could not open " << cfname
<< " for writing " << std::endl; << " for writing " << std::endl;
mt->setFilePointer(NULL); mt->setFilePointer(nullptr);
return 1; return 1;
} }
} }
} }
// //while read frame // //while read frame
framenumber = -1; framenumber = -1;
iframe = 0; iframe = 0;
ifr = 0; ifr = 0;
//std::cout << "Here! " << framenumber << " ";
while ( decoder->readNextFrame(fileh5, framenumber, iframe, buff) ) { while ( decoder->readNextFrame(*fileh5, framenumber, iframe, buff) ) {
//std::cout << "Here! " << framenumber << " ";
// if (np == 40) {
// //push // //push
if ((ifr + 1) % 100 == 0) { if ((ifr + 1) % 100 == 0) {
std::cout << " ****" std::cout << " ****"
<< decoder->getValue(buff, 20, 20); // << std::endl; << decoder->getValue(buff, 20, 20); // << std::endl;
} }
mt->pushData(buff); mt->pushData(buff);
// // //pop // // //pop
mt->nextThread(); mt->nextThread();
mt->popFree(buff); mt->popFree(buff);
ifr++; ++ifr;
if (ifr % 100 == 0) if (ifr % 100 == 0)
std::cout << " " << ifr << " " << framenumber << std::endl; std::cout << " " << ifr << " " << framenumber << std::endl;
if (nframes > 0) { if (nframes > 0) {
@ -526,17 +367,17 @@ int main(int argc, char *argv[]) {
++ioutfile; ++ioutfile;
} }
} }
// } else
//std::cout << ifr << " " << ff << " " << np << std::endl;
framenumber = -1; framenumber = -1;
} }
std::cout << "aa --" << std::endl; std::cout << "aa --" << std::endl;
//filebin.close(); fileh5->CloseResources();
fileh5.CloseResources();
std::cout << "bb --" << std::endl; std::cout << "bb --" << std::endl;
while (mt->isBusy()) { while (mt->isBusy()) {
; ;
} }
std::cout << "cc --" << std::endl; std::cout << "cc --" << std::endl;
if (nframes >= 0) { if (nframes >= 0) {
if (nframes > 0) if (nframes > 0)
@ -547,8 +388,8 @@ int main(int argc, char *argv[]) {
mt->clearImage(); mt->clearImage();
if (of) { if (of) {
fclose(of); fclose(of);
of = NULL; of = nullptr;
mt->setFilePointer(NULL); mt->setFilePointer(nullptr);
} }
} }
std::time(&end_time); std::time(&end_time);
@ -558,12 +399,15 @@ int main(int argc, char *argv[]) {
<< std::endl; << std::endl;
} }
if (nframes < 0) { if (nframes < 0) {
//std::string fname(argv[10]);
std::string fprefix( getRootString(filenames[0]) ); //This might by a non-ideal name choice for that file std::string fprefix( getRootString(filenames[0]) ); //This might by a non-ideal name choice for that file
std::string imgfname( createFileName( outdir, fprefix, "sum", "tiff" ) ); std::string imgfname( createFileName( outdir, fprefix, "sum", "tiff" ) );
std::cout << "Writing tiff to " << imgfname << " " << thr1 << std::endl; std::cout << "Writing tiff to " << imgfname << " " << thr1 << std::endl;
mt->writeImage(imgfname.c_str(), thr1); mt->writeImage(imgfname.c_str(), thr1);
} }
//delete filter;
//delete mt;
delete buff;
return 0; return 0;
} }