From 3c363d82e8566038edee641c607da7623e6c1311 Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Tue, 31 Mar 2015 14:45:45 +0200 Subject: [PATCH] messing up while updating and merging --- slsDetectorCalibration/slsDetectorData.h | 84 ++++++++++++++++++++++++ slsDetectorCalibration/slsReceiverData.h | 4 +- 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index 0030091d7..4f696ae29 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -112,6 +112,7 @@ class slsDetectorData { void setDataMap(int **dMap=NULL) { +<<<<<<< HEAD if (dMap==NULL) { for (int iy=0; iy>>>>>> 7ef3348d521f1a704f974b05dd763cd65253dd98 }; @@ -227,6 +245,58 @@ class slsDetectorData { return d^m; }; + + /** + + 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, int dr) { + dataType m=0, d=0; + uint64_t t; + int numBytes,divFactor,newix,pixelval; + + + if (ix>=0 && ix=0 && iy=0 && dataMap[iy][ix]> (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 value of the selected channel for the given dataset as double. @@ -238,6 +308,20 @@ class slsDetectorData { */ virtual double getValue(char *data, int ix, int iy=0) {return (double)getChannel(data, ix, iy);}; + /** + + Returns the value of the selected channel for the given dataset as double. + \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 as double + + */ + virtual double getValue(char *data, int ix, int iy, int dr) { + return ((double)getChannel(data, ix, iy, dr)); + }; + /** Returns the frame number for the given dataset. Purely virtual func. diff --git a/slsDetectorCalibration/slsReceiverData.h b/slsDetectorCalibration/slsReceiverData.h index e07a757fd..4781cb36e 100644 --- a/slsDetectorCalibration/slsReceiverData.h +++ b/slsDetectorCalibration/slsReceiverData.h @@ -2,6 +2,7 @@ #define SLSRECEIVERDATA_H #include "slsDetectorData.h" +#include template class slsReceiverData : public slsDetectorData { @@ -89,7 +90,7 @@ public: dd+=packetSize; np++; // cout << pnum << " " << fn << " " << np << " " << dd << " " << dsize << endl; - if (np==nPackets) + if (np==nPackets){ if (pnum==nPackets) { // cout << "Frame found!" << endl; break; @@ -97,6 +98,7 @@ public: cout << "Too many packets for this frame! "<< fnum << " " << pnum << endl; retval=NULL; } + } } if (np0)