mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 08:17:13 +02:00
added photon counter no thread
This commit is contained in:
@ -385,88 +385,67 @@ int main(int argc, char *argv[]) {
|
||||
// printf ("+++++++++++++++ %s\n", ent->d_name);
|
||||
if (string(ent->d_name).find(ext)!= string::npos) {
|
||||
//printf ("**************8 %s\n", ent->d_name);
|
||||
|
||||
|
||||
|
||||
sprintf(fname,"%s/%s",indir,ent->d_name);
|
||||
//sprintf(fname,ffname,irun);
|
||||
cout << fname << endl;
|
||||
|
||||
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
// cout << fname << " " << outfname << " " << imgfname << endl;
|
||||
filebin.open((const char *)(fname), ios::in | ios::binary);
|
||||
// //open file
|
||||
ifile=0;
|
||||
if (filebin.is_open()){
|
||||
|
||||
// //while read frame
|
||||
ff=-1;
|
||||
ifr=0;
|
||||
while (decoder->readNextFrame(filebin, ff, np,buff)) {
|
||||
if (np==40) {
|
||||
// cout << "*"<<ifr++<<"*"<<ff<< endl;
|
||||
// cout << ff << " " << np << endl;
|
||||
// //push
|
||||
mt->pushData(buff);
|
||||
// // //pop
|
||||
mt->nextThread();
|
||||
// // // cout << " " << (void*)buff;
|
||||
mt->popFree(buff);
|
||||
|
||||
|
||||
|
||||
|
||||
ifr++;
|
||||
if (ifr%10000==0) cout << ifr << " " << ff << endl;
|
||||
if (nframes>0) {
|
||||
if (ifr%nframes==0) {
|
||||
//The name has an additional "_fXXXXX" at the end, where "XXXXX" is the initial frame number of the image (0,1000,2000...)
|
||||
|
||||
sprintf(ffname,"%s/%s_f%05d.tiff",outdir,fformat,ifile);
|
||||
sprintf(imgfname,ffname,irun);
|
||||
//cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
|
||||
mt->writeImage(imgfname, thr1);
|
||||
mt->clearImage();
|
||||
ifile++;
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
// cout << fname << " " << outfname << " " << imgfname << endl;
|
||||
filebin.open((const char *)(fname), ios::in | ios::binary);
|
||||
// //open file
|
||||
ifile=0;
|
||||
if (filebin.is_open()){
|
||||
// //while read frame
|
||||
ff=-1;
|
||||
ifr=0;
|
||||
while (decoder->readNextFrame(filebin, ff, np,buff)) {
|
||||
if (np==40) {
|
||||
mt->pushData(buff);
|
||||
mt->nextThread();
|
||||
mt->popFree(buff);
|
||||
ifr++;
|
||||
if (ifr%10000==0) cout << ifr << " " << ff << endl;
|
||||
if (nframes>0) {
|
||||
while (mt->isBusy()) {;}
|
||||
if (ifr%nframes==0) {
|
||||
//The name has an additional "_fXXXXX" at the end, where "XXXXX" is the initial frame number of the image (0,1000,2000...)
|
||||
sprintf(ffname,"%s/%s_f%05d.tiff",outdir,fformat,ifile);
|
||||
sprintf(imgfname,ffname,irun);
|
||||
//cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
|
||||
mt->writeImage(imgfname, thr1);
|
||||
mt->clearImage();
|
||||
ifile++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ff=-1;
|
||||
}
|
||||
}
|
||||
}// else
|
||||
// cout << ifr << " " << ff << " " << np << endl;
|
||||
ff=-1;
|
||||
filebin.close();
|
||||
} else
|
||||
cout << "Could not open "<< fname << " for reading " << endl;
|
||||
}
|
||||
}
|
||||
//cout << "--" << endl;
|
||||
filebin.close();
|
||||
} else
|
||||
cout << "Could not open "<< fname << " for reading " << endl;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// //close file
|
||||
// //join threads
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
while (mt->isBusy()) {;}
|
||||
if (nframes>=0) {
|
||||
if (nframes>0) {
|
||||
sprintf(ffname,"%s/%s_f%05d.tiff",outdir,fformat,ifile);
|
||||
sprintf(imgfname,ffname,irun);
|
||||
sprintf(imgfname,ffname,irun);
|
||||
} else {
|
||||
sprintf(imgfname,"%s/%s_%d.tiff",outdir,fformat,irun);
|
||||
//sprintf(imgfname,ffname,irun);
|
||||
}
|
||||
cout << "Writing tiff to " << imgfname << " " << thr1 <<endl;
|
||||
mt->writeImage(imgfname, thr1);
|
||||
mt->clearImage();
|
||||
if (of) {
|
||||
fclose(of);
|
||||
of=NULL;
|
||||
mt->setFilePointer(NULL);
|
||||
}
|
||||
cout << "Writing tiff to " << imgfname << " " << ifr <<endl;
|
||||
mt->writeImage(imgfname, thr1);
|
||||
mt->clearImage();
|
||||
if (of) {
|
||||
fclose(of);
|
||||
of=NULL;
|
||||
mt->setFilePointer(NULL);
|
||||
}
|
||||
}
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
@ -482,7 +461,7 @@ int main(int argc, char *argv[]) {
|
||||
if (nframes<0){
|
||||
sprintf(ffname,"%s/%s.tiff",outdir,fformat);
|
||||
strcpy(imgfname,ffname);
|
||||
cout << "Writing tiff to " << imgfname << " " << thr1 <<endl;
|
||||
cout << "Writing tiff to " << imgfname << " " << ifr <<endl;
|
||||
mt->writeImage(imgfname, thr1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user