mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
fixed long file names in guireducing redundancy in name
This commit is contained in:
@ -4639,6 +4639,7 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
delete [] retdet;
|
delete [] retdet;
|
||||||
//concatenate filenames
|
//concatenate filenames
|
||||||
if(!fullFName.length()){
|
if(!fullFName.length()){
|
||||||
|
//assign file prefix
|
||||||
fullFName.assign(fileIO::getFileName());
|
fullFName.assign(fileIO::getFileName());
|
||||||
if (strrchr(fName,'.')!=NULL){
|
if (strrchr(fName,'.')!=NULL){
|
||||||
ext.assign(fName);
|
ext.assign(fName);
|
||||||
@ -4650,9 +4651,11 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
|
|
||||||
//get variables
|
//get variables
|
||||||
fileIOStatic::getVariablesFromFileName(fName,index, f_index, p_index, sv0, sv1, det_index);
|
fileIOStatic::getVariablesFromFileName(fName,index, f_index, p_index, sv0, sv1, det_index);
|
||||||
|
//append scan and det variables
|
||||||
fullFName.append(fileIOStatic::getReceiverFileNameToConcatenate(fName));
|
fullFName.append(fileIOStatic::getReceiverFileNameToConcatenate(fName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//append only if scan variables are different
|
||||||
if(!fileIOStatic::verifySameFrame(fName,index,f_index, p_index, sv0, sv1, det_index)){
|
if(!fileIOStatic::verifySameFrame(fName,index,f_index, p_index, sv0, sv1, det_index)){
|
||||||
fullFName.append(fileIOStatic::getReceiverFileNameToConcatenate(fName));
|
fullFName.append(fileIOStatic::getReceiverFileNameToConcatenate(fName));
|
||||||
}
|
}
|
||||||
@ -4666,6 +4669,7 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//append extension
|
||||||
fullFName.append(ext);
|
fullFName.append(ext);
|
||||||
strcpy(fName,fullFName.c_str());
|
strcpy(fName,fullFName.c_str());
|
||||||
//if some of the receivers did not give data, dont count it
|
//if some of the receivers did not give data, dont count it
|
||||||
|
@ -161,32 +161,32 @@ class fileIOStatic {
|
|||||||
index=i; \
|
index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse file index from " << s << endl; \
|
/* else cout << "Warning: ******************************** cannot parse file index from " << s << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
else cout << "Warning: ******************************** cannot parse frame index from " << s << endl; \
|
/*else cout << "Warning: ******************************** cannot parse frame index from " << s << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
else cout << "Warning: ******************************** cannot parse detector index from " << s << endl; \
|
/* else cout << "Warning: ******************************** cannot parse detector index from " << s << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
|
||||||
p_index=i; \
|
p_index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse position index from " << s << endl; \
|
/* else cout << "Warning: ******************************** cannot parse position index from " << s << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
|
||||||
sv1=f; \
|
sv1=f; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse scan varable 1 from " << s << endl; \
|
/* else cout << "Warning: ******************************** cannot parse scan varable 1 from " << s << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
|
||||||
sv0=f; \
|
sv0=f; \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse scan varable 0 from " << s << endl; \
|
/* else cout << "Warning: ******************************** cannot parse scan varable 0 from " << s << endl; \*/
|
||||||
return index; \
|
return index; \
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -216,37 +216,37 @@ class fileIOStatic {
|
|||||||
index=i; \
|
index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse file index" << endl; \
|
/*else cout << "Warning: ******************************** cannot parse file index" << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) { \
|
||||||
f_index=i; \
|
f_index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse frame index" << endl; \
|
/*else cout << "Warning: ******************************** cannot parse frame index" << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) { \
|
||||||
detindex=i; \
|
detindex=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse detector id" << endl; \
|
/* else cout << "Warning: ******************************** cannot parse detector id" << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
|
||||||
p_index=i; \
|
p_index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse position index" << endl; \
|
/*else cout << "Warning: ******************************** cannot parse position index" << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
|
||||||
sv1=f; \
|
sv1=f; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse scan varable 1" << endl; \
|
/*else cout << "Warning: ******************************** cannot parse scan varable 1" << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
|
||||||
sv0=f; \
|
sv0=f; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "Warning: ******************************** cannot parse scan varable 0" << endl; \
|
/*else cout << "Warning: ******************************** cannot parse scan varable 0" << endl; \*/
|
||||||
|
|
||||||
return index; \
|
return index; \
|
||||||
};
|
};
|
||||||
@ -314,20 +314,32 @@ class fileIOStatic {
|
|||||||
\returns file name without file name prefix, detector index or extension
|
\returns file name without file name prefix, detector index or extension
|
||||||
*/
|
*/
|
||||||
static string getReceiverFileNameToConcatenate(string fname) { \
|
static string getReceiverFileNameToConcatenate(string fname) { \
|
||||||
//int i;
|
int i;double f; \
|
||||||
string s=fname; \
|
string s=fname; \
|
||||||
if(fname.empty()) return fname; \
|
if(fname.empty()) return fname; \
|
||||||
size_t slash=s.rfind("/"); \
|
size_t dot=s.find(".");
|
||||||
if (slash!= string::npos) \
|
size_t uscore=s.rfind("_"); \
|
||||||
s=s.substr(slash,s.size()-slash); \
|
|
||||||
size_t dot=s.find("."); \
|
if (uscore==string::npos) return "??"; \
|
||||||
size_t uscore=s.find("_"); \
|
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) \
|
||||||
if ((dot!= string::npos)&&(uscore!= string::npos)) \
|
s=fname.substr(0,uscore); \
|
||||||
s=s.substr(uscore,dot-uscore); \
|
uscore=s.rfind("_"); \
|
||||||
// uscore=s.find("_",1);
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) \
|
||||||
//if ((uscore!= string::npos) && (sscanf( s.substr(1,uscore-1).c_str(),"d%d",&i)))
|
s=fname.substr(0,uscore); \
|
||||||
//s=s.substr(uscore,s.size()-uscore);
|
uscore=s.rfind("_"); \
|
||||||
return s; \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
|
||||||
|
s=fname.substr(0,uscore); \
|
||||||
|
uscore=s.rfind("_"); \
|
||||||
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) \
|
||||||
|
s=fname.substr(0,uscore); \
|
||||||
|
uscore=s.rfind("_"); \
|
||||||
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) \
|
||||||
|
s=fname.substr(0,uscore); \
|
||||||
|
uscore=s.rfind("_"); \
|
||||||
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) \
|
||||||
|
s=fname.substr(0,uscore); \
|
||||||
|
return(fname.substr(s.size(),dot-s.size()));\
|
||||||
|
\
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user