mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
reduced size of file names in gui
This commit is contained in:
parent
2f160a7c28
commit
f546814d39
@ -4598,6 +4598,8 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
int *retdet = NULL, *p=retval;
|
int *retdet = NULL, *p=retval;
|
||||||
string fullFName="";
|
string fullFName="";
|
||||||
string ext="";
|
string ext="";
|
||||||
|
int index=-1,f_index=-1,p_index=-1,det_index=-1;
|
||||||
|
double sv0=-1,sv1=-1;
|
||||||
|
|
||||||
if(getDetectorsType() == EIGER){
|
if(getDetectorsType() == EIGER){
|
||||||
maxX = thisMultiDetector->numberOfChannel[X];
|
maxX = thisMultiDetector->numberOfChannel[X];
|
||||||
@ -4645,9 +4647,15 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
ext = ext.erase(0,dot);
|
ext = ext.erase(0,dot);
|
||||||
else
|
else
|
||||||
ext = "";
|
ext = "";
|
||||||
|
|
||||||
|
//get variables
|
||||||
|
fileIOStatic::getVariablesFromFileName(fName,index, f_index, p_index, sv0, sv1, det_index);
|
||||||
|
fullFName.append(fileIOStatic::getReceiverFileNameToConcatenate(fName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fullFName.append(getReceiverFileNameToConcatenate(fName));
|
if(!fileIOStatic::verifySameFrame(fName,index,f_index, p_index, sv0, sv1, det_index)){
|
||||||
|
fullFName.append(fileIOStatic::getReceiverFileNameToConcatenate(fName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
|
@ -161,32 +161,32 @@ class fileIOStatic {
|
|||||||
index=i; \
|
index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "******************************** 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 << "******************************** 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 << "******************************** 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 << "******************************** cannot parse position index" << 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 << "******************************** cannot parse scan varable 1" << 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 << "******************************** cannot parse scan varable 0" << endl; \
|
else cout << "Warning: ******************************** cannot parse scan varable 0 from " << s << endl; \
|
||||||
return index; \
|
return index; \
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -216,41 +216,68 @@ class fileIOStatic {
|
|||||||
index=i; \
|
index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "******************************** 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 << "******************************** 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); \
|
||||||
} \
|
} \
|
||||||
else cout << "******************************** 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 << "******************************** 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 << "******************************** 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 << "******************************** cannot parse scan varable 0" << endl; \
|
else cout << "Warning: ******************************** cannot parse scan varable 0" << endl; \
|
||||||
|
|
||||||
return index; \
|
return index; \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** static function that verifies if the new file name containing new parameters matches all the given parameters
|
||||||
|
\param fname new complete file name prefix
|
||||||
|
\param index reference to index
|
||||||
|
\param f_index reference to frame index
|
||||||
|
\param p_index reference to position index
|
||||||
|
\param sv0 reference to scan variable 0
|
||||||
|
\param sv1 reference to scan variable 1
|
||||||
|
\param detindex reference to detector id
|
||||||
|
\returns file name
|
||||||
|
*/
|
||||||
|
static int verifySameFrame(string fname, int index, int f_index, int p_index, double sv0, double sv1, int detindex) { \
|
||||||
|
int new_index=-1;
|
||||||
|
int new_f_index=-1;
|
||||||
|
int new_p_index=-1;
|
||||||
|
int new_det_index=-1;
|
||||||
|
double new_sv0=-1;
|
||||||
|
double new_sv1=-1;
|
||||||
|
getVariablesFromFileName(fname,new_index, new_f_index, new_p_index, new_sv0, new_sv1, new_det_index);
|
||||||
|
if(index!=new_index) return 0;
|
||||||
|
if(f_index!=new_f_index) return 0;
|
||||||
|
if(p_index!=new_p_index) return 0;
|
||||||
|
if(sv0!=new_sv0) return 0;
|
||||||
|
if(sv1!=new_sv1) return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** static function that returns the name variable from the receiver complete file name prefix
|
/** static function that returns the name variable from the receiver complete file name prefix
|
||||||
\param fname complete file name prefix
|
\param fname complete file name prefix
|
||||||
|
Loading…
x
Reference in New Issue
Block a user