mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
moved getchannel back to slsdetectordata as it doesnt work for eiger
This commit is contained in:
parent
83a766914f
commit
0c2bd83e96
@ -134,56 +134,9 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
|
||||||
\param data pointer to the dataset (including headers etc)
|
|
||||||
\param ix pixel number in the x direction
|
|
||||||
\param iy pixel number in the y direction
|
|
||||||
\param dr dynamic range
|
|
||||||
\returns data for the selected channel, with inversion if required
|
|
||||||
|
|
||||||
*/
|
|
||||||
virtual dataType getChannel(char *data, int ix, int iy=0, int dr=0) {
|
|
||||||
dataType m=0, d=0;
|
|
||||||
uint64_t t;
|
|
||||||
int numBytes,divFactor,newix,pixelval;
|
|
||||||
|
|
||||||
|
|
||||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
|
||||||
m=dataMask[iy][ix];
|
|
||||||
|
|
||||||
numBytes = (nx * iy + ix);
|
|
||||||
divFactor=2;
|
|
||||||
if(dr == 4) divFactor = 16;
|
|
||||||
else if (dr == 8) divFactor = 8;
|
|
||||||
else if (dr == 16) divFactor = 4;
|
|
||||||
|
|
||||||
pixelval = numBytes % divFactor;
|
|
||||||
newix = ix - pixelval;
|
|
||||||
|
|
||||||
//cout <<"pixelval:"<<pixelval<<" newix:"<<newix<<endl;
|
|
||||||
//cout <<"64:"<< hex<<((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix])))))<<endl;
|
|
||||||
t = (be64toh((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix]))))));
|
|
||||||
//cout<<"t:"<<t<<endl;
|
|
||||||
|
|
||||||
}else
|
|
||||||
cprintf(RED,"outside limits\n");
|
|
||||||
|
|
||||||
if(dr == 4)
|
|
||||||
//uint8_t value = t >> (pixelval*4); cout <<"value:"<< value << endl;
|
|
||||||
return ((t >> (pixelval*4)) & 0xf)^m;
|
|
||||||
else if(dr == 8)
|
|
||||||
//uint8_t value = t >> (pixelval*8); cout <<"value:"<< value << endl;
|
|
||||||
return ((t >> (pixelval*8)) & 0xff)^m;
|
|
||||||
else if(dr == 16){
|
|
||||||
//uint16_t value = t >> (pixelval*16); cout <<"value:"<< value << endl;
|
|
||||||
return ((t >> (pixelval*16)) & 0xffff)^m;
|
|
||||||
}else{
|
|
||||||
//uint32_t value = t >> (pixelval*32); cout <<"value:"<< value << endl;
|
|
||||||
return ((t >> (pixelval*32)) & 0xffffffff)^m;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** Returns the frame number for the given dataset.
|
/** Returns the frame number for the given dataset.
|
||||||
|
@ -105,9 +105,9 @@ class slsDetectorData {
|
|||||||
for (int ix=0; ix<nx; ix++) {
|
for (int ix=0; ix<nx; ix++) {
|
||||||
dataMap[iy][ix]=dMap[iy][ix];
|
dataMap[iy][ix]=dMap[iy][ix];
|
||||||
// cout << ix << " " << iy << endl;
|
// cout << ix << " " << iy << endl;
|
||||||
ip=dataMap[ix][iy]/sizeof(dataType);
|
/*ip=dataMap[ix][iy]/sizeof(dataType);
|
||||||
xmap[ip]=ix;
|
xmap[ip]=ix;
|
||||||
ymap[ip]=iy;
|
ymap[ip]=iy;Annaa*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ class slsDetectorData {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
virtual dataType getChannel(char *data, int ix, int iy=0, int dr=0) {
|
virtual dataType getChannel(char *data, int ix, int iy=0) {
|
||||||
dataType m=0, d=0;
|
dataType m=0, d=0;
|
||||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
||||||
m=dataMask[iy][ix];
|
m=dataMask[iy][ix];
|
||||||
@ -210,7 +210,10 @@ class slsDetectorData {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||||
\param data pointer to the dataset (including headers etc)
|
\param data pointer to the dataset (including headers etc)
|
||||||
\param ix pixel number in the x direction
|
\param ix pixel number in the x direction
|
||||||
@ -219,6 +222,7 @@ class slsDetectorData {
|
|||||||
\returns data for the selected channel, with inversion if required
|
\returns data for the selected channel, with inversion if required
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual dataType getChannel(char *data, int ix, int iy, int dr) {
|
virtual dataType getChannel(char *data, int ix, int iy, int dr) {
|
||||||
dataType m=0;
|
dataType m=0;
|
||||||
uint64_t t;
|
uint64_t t;
|
||||||
@ -227,7 +231,7 @@ class slsDetectorData {
|
|||||||
|
|
||||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
||||||
m=dataMask[iy][ix];
|
m=dataMask[iy][ix];
|
||||||
//cout <<"ix:"<<dec<<ix<<" iy:"<<iy<<endl;
|
|
||||||
numBytes = (nx * iy + ix);
|
numBytes = (nx * iy + ix);
|
||||||
divFactor=2;
|
divFactor=2;
|
||||||
if(dr == 4) divFactor = 16;
|
if(dr == 4) divFactor = 16;
|
||||||
@ -237,10 +241,10 @@ class slsDetectorData {
|
|||||||
pixelval = numBytes % divFactor;
|
pixelval = numBytes % divFactor;
|
||||||
newix = ix - pixelval;
|
newix = ix - pixelval;
|
||||||
|
|
||||||
//cout <<"pixelval:"<<dec <<pixelval<<" newix:"<<newix<<endl;
|
//cout <<"pixelval:"<<pixelval<<" newix:"<<newix<<endl;
|
||||||
// cout <<"64:"<< hex<<((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix])))))<<endl;
|
//cout <<"64:"<< hex<<((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix])))))<<endl;
|
||||||
t = (be64toh((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix]))))));
|
t = (be64toh((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix]))))));
|
||||||
// cout<<"t:"<<hex<<t<<endl;
|
//cout<<"t:"<<t<<endl;
|
||||||
|
|
||||||
}else
|
}else
|
||||||
cprintf(RED,"outside limits\n");
|
cprintf(RED,"outside limits\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user