#ifndef SLSDETECTORDATA_H #define SLSDETECTORDATA_H #include #include #include using namespace std; template class slsDetectorData { public: /** General slsDetectors data structure. Works for data acquired using the slsDetectorReceiver. Can be generalized to other detectors (many virtual funcs). Constructor (no error checking if datasize and offsets are compatible!) \param npx number of pixels in the x direction \param npy number of pixels in the y direction (1 for strips) \param dsize size of the data \param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset) \param dMask Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required) \param dROI Array of size nx*ny. The elements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s. */ slsDetectorData(int npx, int npy, int dsize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): nx(npx), ny(npy), dataSize(dsize) { dataMask=new dataType*[ny]; for(int i = 0; i < ny; i++) { dataMask[i] = new dataType[nx]; } dataMap=new int*[ny]; for(int i = 0; i < ny; i++) { dataMap[i] = new int[nx]; } dataROIMask=new int*[ny]; for(int i = 0; i < ny; i++) { dataROIMask[i] = new int[nx]; } setDataMap(dMap); setDataMask(dMask); setDataROIMask(dROI); }; virtual ~slsDetectorData() { for(int i = 0; i < ny; i++) { delete [] dataMap[i]; delete [] dataMask[i]; delete [] dataROIMask[i]; } delete [] dataMap; delete [] dataMask; delete [] dataROIMask; } /** defines the data map (as offset) - no error checking if datasize and offsets are compatible! \param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset). If NULL (default),the data are arranged as if read out row by row (dataMap[iy][ix]=(iy*nx+ix)*sizeof(dataType);) */ void setDataMap(int **dMap=NULL) { if (dMap==NULL) { for (int iy=0; iy=0 && ix=0 && iy=0 && ix=0 && iy=0 && ix=0 && iy=0 && dataMap[iy][ix]