added loadimage function

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@147 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2012-03-16 13:06:28 +00:00
parent 2076fb75f5
commit af864279a5
2 changed files with 40 additions and 7 deletions

View File

@ -236,7 +236,6 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
// #ifdef VERBOSE
// cout << "done" << endl;
// #endif
}
multiSlsDetector::~multiSlsDetector() {
@ -1022,6 +1021,7 @@ int* multiSlsDetector::getDataFromDetector() {
};
int* multiSlsDetector::readFrame(){
int nel=thisMultiDetector->dataBytes/sizeof(int);
int n;
@ -2500,6 +2500,44 @@ int multiSlsDetector::configureMAC() {
}
int multiSlsDetector::loadImageToDetector(imageType index,string const fname){
int ret=-100, ret1;
short int arg[thisMultiDetector->numberOfChannels];
ifstream infile;
infile.open(fname.c_str(), ios_base::in);
if (infile.is_open()) {
#ifdef VERBOSE
std::cout<< std::endl<< "Loading ";
if(!index)
std::cout<<"Dark";
else
std::cout<<"Gain";
std::cout<<" image from file " << fname << std::endl;
#endif
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
if (detectors[idet]) {
if(detectors[idet]->readDataFile(infile,arg)>=0){
ret1=detectors[idet]->sendImageToDetector(index,arg);
if (ret==-100)
ret=ret1;
else if (ret!=ret1)
ret=-1;
}
}
}
infile.close();
} else {
std::cout<< "Could not open file "<< fname << std::endl;
return -1;
}
return ret;
}
int multiSlsDetector::setDynamicRange(int p) {
int ret=-100, ret1;
@ -3180,10 +3218,8 @@ int multiSlsDetector::retrieveDetectorSetup(string const fname1, int level){
int multiSlsDetector::loadImageToDetector(imageType t, string s) {
return OK;
}
int multiSlsDetector::testFunction(int times) {
return OK;
}

View File

@ -493,7 +493,7 @@ class multiSlsDetector : public slsDetectorUtils {
\returns pointer to the data or NULL. If NULL disconnects the socket
\sa getDataFromDetector
*/
int* getDataFromDetector();
int* getDataFromDetector();
/**
asks and receives a data frame from the detector and puts it in the data queue
@ -853,9 +853,6 @@ class multiSlsDetector : public slsDetectorUtils {
int configureMAC();
int setNumberOfModules(int i=-1, dimension d=X);
int getMaxNumberOfModules(dimension d=X);
int setDynamicRange(int i=-1);