mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
double* changed to char* in gui data call back, decoding to be done by caller. enablegappixels skeleton created
This commit is contained in:
parent
1a8b0692fe
commit
afc08f8c30
@ -282,8 +282,6 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
|
|||||||
threadpool = 0;
|
threadpool = 0;
|
||||||
if(createThreadPool() == FAIL)
|
if(createThreadPool() == FAIL)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
gainDataEnable = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
multiSlsDetector::~multiSlsDetector() {
|
multiSlsDetector::~multiSlsDetector() {
|
||||||
@ -5711,7 +5709,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::getData(const int isocket, int* image, const int size,
|
int multiSlsDetector::getData(const int isocket, char* image, const int size,
|
||||||
uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename) {
|
uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename) {
|
||||||
|
|
||||||
//fail is on parse error or end of acquisition
|
//fail is on parse error or end of acquisition
|
||||||
@ -5786,18 +5784,6 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int expectedslssize = slsdatabytes/numSocketsPerSLSDetector;
|
int expectedslssize = slsdatabytes/numSocketsPerSLSDetector;
|
||||||
/*int* image = new int[(expectedslssize/sizeof(int))]();
|
|
||||||
int nel=(thisMultiDetector->dataBytes)/sizeof(int);
|
|
||||||
if(nel <= 0){
|
|
||||||
cprintf(RED,"Error: Multislsdetector databytes not valid : %d\n", thisMultiDetector->dataBytes);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int* multiframe=new int[nel]();
|
|
||||||
int* multiframegain=NULL;
|
|
||||||
if (jungfrau)
|
|
||||||
multiframegain = new int[nel]();
|
|
||||||
*/
|
|
||||||
|
|
||||||
char* image = new char[expectedslssize]();
|
char* image = new char[expectedslssize]();
|
||||||
char* multiframe = new char[thisMultiDetector->dataBytes]();
|
char* multiframe = new char[thisMultiDetector->dataBytes]();
|
||||||
char* multiframegain = NULL;
|
char* multiframegain = NULL;
|
||||||
@ -5822,7 +5808,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
|
|
||||||
//exit when last message for each socket received
|
//exit when last message for each socket received
|
||||||
while(running){
|
while(running){
|
||||||
memset(multiframe,0xFF,slsdatabytes*thisMultiDetector->numberOfDetectors);/*memset(((char*)multiframe),0xFF,slsdatabytes*thisMultiDetector->numberOfDetectors);*/ //reset frame memory
|
memset(multiframe,0xFF,slsdatabytes*thisMultiDetector->numberOfDetectors); //reset frame memory
|
||||||
|
|
||||||
//get each frame
|
//get each frame
|
||||||
for(int isocket=0; isocket<numSockets; ++isocket){
|
for(int isocket=0; isocket<numSockets; ++isocket){
|
||||||
@ -5830,7 +5816,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
//if running
|
//if running
|
||||||
if (runningList[isocket]) {
|
if (runningList[isocket]) {
|
||||||
//get individual images
|
//get individual images
|
||||||
if(FAIL == getData(isocket, (int*)image, expectedslssize, currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex,currentFileName)){
|
if(FAIL == getData(isocket, image, expectedslssize, currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex,currentFileName)){
|
||||||
runningList[isocket] = false;
|
runningList[isocket] = false;
|
||||||
--numRunning;
|
--numRunning;
|
||||||
continue;
|
continue;
|
||||||
@ -5884,37 +5870,11 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
|
|
||||||
//send data to callback
|
//send data to callback
|
||||||
if(running){
|
if(running){
|
||||||
/*
|
|
||||||
if (jungfrau) {
|
|
||||||
// with gain data
|
|
||||||
if (gainDataEnable) {
|
|
||||||
memcpy(multiframegain, multiframe, nel * sizeof(int));
|
|
||||||
for(unsigned int i=0;i<nel;++i){
|
|
||||||
multiframegain[i] = ((multiframe[i] & 0xC0000000) >> 14) | ((multiframe[i] & 0x0000C000) >> 14) ;
|
|
||||||
multiframe[i] = (multiframe[i] & 0x3FFF3FFF);
|
|
||||||
}
|
|
||||||
gdata = decodeData(multiframegain,nch);
|
|
||||||
}
|
|
||||||
// without gain data
|
|
||||||
else {
|
|
||||||
for(unsigned int i=0;i<nel;++i)
|
|
||||||
multiframe[i] = (multiframe[i] & 0x3FFF3FFF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fdata = decodeData(multiframe,nch);
|
|
||||||
if ((fdata) && (dataReady)){
|
|
||||||
thisData = new detectorData(fdata, NULL,NULL,getCurrentProgress(),currentFileName.c_str(),maxX,maxY, gdata);
|
|
||||||
dataReady(thisData, currentFrameIndex, currentSubFrameIndex, pCallbackArg);
|
|
||||||
delete thisData;
|
|
||||||
fdata = NULL;
|
|
||||||
gdata = NULL;
|
|
||||||
//cout<<"Send frame #"<< currentFrameIndex << " to gui"<<endl;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if(dataReady) {
|
if(dataReady) {
|
||||||
thisData = new detectorData(multiframe, thisMultiDetector->dataBytes, NULL,NULL,getCurrentProgress(),currentFileName.c_str(),maxX,maxY);
|
thisData = new detectorData(NULL,NULL,NULL,getCurrentProgress(),currentFileName.c_str(),maxX,maxY,multiframe, thisMultiDetector->dataBytes);
|
||||||
dataReady(thisData, currentFrameIndex, currentSubFrameIndex, pCallbackArg);
|
dataReady(thisData, currentFrameIndex, currentSubFrameIndex, pCallbackArg);
|
||||||
delete thisData;
|
delete thisData;
|
||||||
|
//cout<<"Send frame #"<< currentFrameIndex << " to gui"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCurrentProgress(currentAcquisitionIndex+1);
|
setCurrentProgress(currentAcquisitionIndex+1);
|
||||||
@ -6542,7 +6502,3 @@ bool multiSlsDetector::getExternalGuiFlag(){
|
|||||||
return thisMultiDetector->externalgui;
|
return thisMultiDetector->externalgui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void multiSlsDetector::setGainDataEnableinDataCallback(bool e) {
|
|
||||||
gainDataEnable = e;
|
|
||||||
}
|
|
||||||
|
@ -1477,13 +1477,6 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
*/
|
*/
|
||||||
bool getExternalGuiFlag();
|
bool getExternalGuiFlag();
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Gain Data enable for gain plot
|
|
||||||
* in data call back
|
|
||||||
* @param e enable
|
|
||||||
*/
|
|
||||||
void setGainDataEnableinDataCallback(bool e);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1498,7 +1491,7 @@ private:
|
|||||||
* @param subframeIndex address of subframe index
|
* @param subframeIndex address of subframe index
|
||||||
* @param filename address of file name
|
* @param filename address of file name
|
||||||
*/
|
*/
|
||||||
int getData(const int isocket, int* image, const int size, uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename);
|
int getData(const int isocket, char* image, const int size, uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename);
|
||||||
|
|
||||||
|
|
||||||
/** Ensures if sockets created successfully */
|
/** Ensures if sockets created successfully */
|
||||||
@ -1522,9 +1515,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
ThreadPool* threadpool;
|
ThreadPool* threadpool;
|
||||||
|
|
||||||
/** Gain Data enabled in data call back */
|
|
||||||
bool gainDataEnable;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,28 +18,27 @@ class detectorData {
|
|||||||
\param ny dimension in y (1D detector)
|
\param ny dimension in y (1D detector)
|
||||||
\param gval pointer to gain data (for jungfrau)
|
\param gval pointer to gain data (for jungfrau)
|
||||||
*/
|
*/
|
||||||
detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double p_ind=-1, const char *fname="", int np=-1, int ny=1, double* gval=NULL) : cvalues(NULL), databytes(-1), values(val), errors(err), angles(ang), progressIndex(p_ind), npoints(np), npy(ny), gvalues(gval){
|
detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double p_ind=-1, const char *fname="", int np=-1, int ny=1, char *cval=NULL, int dbytes=0) : values(val), errors(err), angles(ang), progressIndex(p_ind), npoints(np), npy(ny), cvalues(cval), databytes(dbytes), dgainvalues(NULL) {
|
||||||
strcpy(fileName,fname);
|
strcpy(fileName,fname);
|
||||||
};
|
};
|
||||||
detectorData(char *val=NULL, int db=0, double *err=NULL, double *ang=NULL, double p_ind=-1, const char *fname="", int np=-1, int ny=1, double* gval=NULL) : cvalues(val), databytes(db), values(NULL), errors(err), angles(ang), progressIndex(p_ind), npoints(np), npy(ny), gvalues(gval){
|
|
||||||
strcpy(fileName,fname);
|
/**
|
||||||
};
|
|
||||||
/**
|
|
||||||
@short The destructor
|
@short The destructor
|
||||||
deletes also the arrays pointing to data/errors/angles if not NULL
|
deletes also the arrays pointing to data/errors/angles if not NULL
|
||||||
*/
|
cvalues are deleted by caller
|
||||||
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles; if (gvalues) delete [] gvalues;};
|
*/
|
||||||
|
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles; if(dgainvalues) delete [] dgainvalues;};
|
||||||
//private:
|
//private:
|
||||||
char* cvalues;
|
double *values; /**< @short pointer to the data as double array */
|
||||||
int databytes;
|
|
||||||
double *values; /**< @short pointer to the data */
|
|
||||||
double *errors; /**< @short pointer to the errors */
|
double *errors; /**< @short pointer to the errors */
|
||||||
double *angles;/**< @short pointer to the angles (NULL if no angular conversion) */
|
double *angles;/**< @short pointer to the angles (NULL if no angular conversion) */
|
||||||
double progressIndex;/**< @short file index */
|
double progressIndex;/**< @short file index */
|
||||||
char fileName[1000];/**< @short file name */
|
char fileName[1000];/**< @short file name */
|
||||||
int npoints;/**< @short number of points */
|
int npoints;/**< @short number of points */
|
||||||
int npy;/**< @short dimensions in y coordinate*/
|
int npy;/**< @short dimensions in y coordinate*/
|
||||||
double *gvalues; /**< @short pointer to the gain data */
|
char* cvalues; /**< @short pointer to the data as char arary */
|
||||||
|
int databytes; /**< @short number of bytes of data. Used with cvalues */
|
||||||
|
double* dgainvalues; /**< @short pointer to gain data as double array */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ s
|
|||||||
|
|
||||||
|
|
||||||
double *fdata;
|
double *fdata;
|
||||||
int (*dataReady)(detectorData*,int, int,void*);
|
int (*dataReady)(detectorData*,int, int, void*);
|
||||||
void *pCallbackArg;
|
void *pCallbackArg;
|
||||||
detectorData *thisData;
|
detectorData *thisData;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user