users: added setroi and getroi, modified multi to allow imod for setroi on sls level, modified detectorsize to set a single roi or give roi if only one roi

This commit is contained in:
maliakal_d 2018-12-03 11:50:56 +01:00
parent c611523352
commit 2cebec90ee
8 changed files with 62 additions and 23 deletions

View File

@ -3261,7 +3261,10 @@ void multiSlsDetector::verifyMinMaxROI(int n, ROI r[]) {
} }
} }
int multiSlsDetector::setROI(int n, ROI roiLimits[]) { int multiSlsDetector::setROI(int n, ROI roiLimits[], int imod) {
if (imod > 0 && imod < (int)detectors.size()) {
return detectors[imod]->setROI(n, roiLimits, imod);
}
int ret1 = -100, ret; int ret1 = -100, ret;
int i, xmin, xmax, ymin, ymax, channelX, channelY, idet, lastChannelX, int i, xmin, xmax, ymin, ymax, channelX, channelY, idet, lastChannelX,
lastChannelY, index, offsetX, offsetY; lastChannelY, index, offsetX, offsetY;
@ -3393,8 +3396,10 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[]) {
} }
slsDetectorDefs::ROI* multiSlsDetector::getROI(int& n) { slsDetectorDefs::ROI* multiSlsDetector::getROI(int& n, int imod) {
if (imod > 0 && imod < (int)detectors.size()) {
return detectors[imod]->getROI(n, imod);
}
n = 0; n = 0;
int num = 0, i, j; int num = 0, i, j;
int ndet = detectors.size(); int ndet = detectors.size();

View File

@ -1222,16 +1222,18 @@ public:
* At the moment only one set allowed * At the moment only one set allowed
* @param n number of rois * @param n number of rois
* @param roiLimits array of roi * @param roiLimits array of roi
* @param imod module number (-1 for all)
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int setROI(int n=-1,ROI roiLimits[]=NULL); int setROI(int n=-1,ROI roiLimits[]=NULL, int imod = -1);
/** /**
* Get ROI from each detector and convert it to the multi detector scale (Gotthard) * Get ROI from each detector and convert it to the multi detector scale (Gotthard)
* @param n number of rois * @param n number of rois
* @returns OK or FAIL * @param imod module number (-1 for all)
* @returns pointer to array of ROI structure
*/ */
ROI* getROI(int &n); ROI* getROI(int &n, int imod = -1);
/** /**
* Write to ADC register (Gotthard, Jungfrau, ChipTestBoard). For expert users * Write to ADC register (Gotthard, Jungfrau, ChipTestBoard). For expert users

View File

@ -6017,7 +6017,7 @@ int slsDetector::setCounterBit(int i) {
int slsDetector::setROI(int n,ROI roiLimits[]) { int slsDetector::setROI(int n,ROI roiLimits[], int imod) {
int ret = FAIL; int ret = FAIL;
//sort ascending order //sort ascending order
int temp; int temp;
@ -6053,7 +6053,7 @@ int slsDetector::setROI(int n,ROI roiLimits[]) {
} }
slsDetectorDefs::ROI* slsDetector::getROI(int &n) { slsDetectorDefs::ROI* slsDetector::getROI(int &n, int imod) {
sendROI(-1,NULL); sendROI(-1,NULL);
n=thisDetector->nROI; n=thisDetector->nROI;
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels(); if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();

View File

@ -1500,16 +1500,18 @@ public:
* At the moment only one set allowed * At the moment only one set allowed
* @param n number of rois * @param n number of rois
* @param roiLimits array of roi * @param roiLimits array of roi
* @param imod module number (ignored)
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int setROI(int n=-1,ROI roiLimits[]=NULL); int setROI(int n=-1,ROI roiLimits[]=NULL, int imod = -1);
/** /**
* Get ROI from each detector and convert it to the multi detector scale (Gotthard) * Get ROI from each detector and convert it to the multi detector scale (Gotthard)
* @param n number of rois * @param n number of rois
* @returns OK or FAIL * @param imod module number (ignored)
* @returns pointer to array of ROI structure
*/ */
slsDetectorDefs::ROI* getROI(int &n); ROI* getROI(int &n, int imod = -1);
/** /**
* Returns number of rois * Returns number of rois

View File

@ -4534,7 +4534,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
ret=myDet->setDynamicRange(val); ret=myDet->setDynamicRange(val);
} else if (cmd=="roi") { } else if (cmd=="roi") {
ROI* r = myDet->getROI(ret); ROI* r = myDet->getROI(ret);
if (r != NULL) if (myDet->isMultiSlsDetectorClass() && r != NULL)
delete [] r; delete [] r;
} else if (cmd=="detsizechan") { } else if (cmd=="detsizechan") {
sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y)); sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y));
@ -6997,7 +6997,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
} }
} }
os << hex << reg << dec; os << hex << reg << dec;
if (aa != NULL) if (myDet->isMultiSlsDetectorClass() && aa != NULL)
delete [] aa; delete [] aa;

View File

@ -135,7 +135,7 @@ int slsDetectorUsers::getDetectorSize(int &x0, int &y0, int &nx, int &ny){
slsDetectorDefs::ROI* roi = myDetector->getROI(n); slsDetectorDefs::ROI* roi = myDetector->getROI(n);
// roi // roi
if (roi != NULL && n > 0) { if (roi != NULL && n == 1) {
x0 = roi[0].xmin; x0 = roi[0].xmin;
y0 = roi[0].ymin; y0 = roi[0].ymin;
nx = roi[0].xmax - roi[0].xmin; nx = roi[0].xmax - roi[0].xmin;
@ -513,3 +513,11 @@ int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int imod) {
int slsDetectorUsers::setStoragecellStart(int pos) { int slsDetectorUsers::setStoragecellStart(int pos) {
return myDetector->setStoragecellStart(pos); return myDetector->setStoragecellStart(pos);
} }
int slsDetectorUsers::setROI(int n, slsDetectorDefs::ROI roiLimits[], int imod) {
return myDetector->setROI(n, roiLimits, imod);
}
slsDetectorDefs::ROI* slsDetectorUsers::getROI(int &n, int imod) {
return myDetector->getROI(n, imod);
}

View File

@ -17,6 +17,8 @@ class detectorData;
class multiSlsDetector; class multiSlsDetector;
class multiSlsDetectorCommand; class multiSlsDetectorCommand;
#include "sls_detector_defs.h"
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
@ -256,9 +258,8 @@ class slsDetectorUsers
*/ */
int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1); int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
/** /**
@short gets detector size @short gets detector size (roi size if only one roi)
\param x0 horizontal position origin in channel number \param x0 horizontal position origin in channel number
\param y0 vertical position origin in channel number \param y0 vertical position origin in channel number
\param nx number of channels in horiziontal \param nx number of channels in horiziontal
@ -818,6 +819,25 @@ class slsDetectorUsers
*/ */
int setStoragecellStart(int pos=-1); int setStoragecellStart(int pos=-1);
/**
* Set ROI (Gotthard) (>= 1 roi, but max 1 roi per module)
* At the moment only one set allowed
* @param n number of rois
* @param roiLimits array of roi
* @param imod module number (-1 for all)
* @returns OK or FAIL
*/
int setROI(int n=-1, slsDetectorDefs::ROI roiLimits[]=NULL, int imod = -1);
/**
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
* >= 1 roi, but max 1 roi per module
* @param n number of rois
* @param imod module number (ignored)
* @returns pointer to array of ROI structure
*/
slsDetectorDefs::ROI* getROI(int &n, int imod = -1);
/************************************************************************ /************************************************************************
STATIC FUNCTIONS STATIC FUNCTIONS

View File

@ -869,16 +869,18 @@ virtual int calibratePedestal(int frames = 0)=0;
set roi set roi
\param n number of rois \param n number of rois
\param roiLimits array of roi \param roiLimits array of roi
\param imod module number (-1 for all)
\returns success or failure \returns success or failure
*/ */
virtual int setROI(int n=-1,ROI roiLimits[]=NULL)=0; virtual int setROI(int n=-1,ROI roiLimits[]=NULL, int imod = -1)=0;
/** /**
get roi from each detector and convert it to the multi detector scale get roi from each detector and convert it to the multi detector scale
\param n number of rois \param n number of rois
\returns an array of multidetector's rois \param imod module number (-1 for all)
\returns pointer to array of ROI structure
*/ */
virtual ROI* getROI(int &n)=0; virtual ROI* getROI(int &n, int imod = -1)=0;
/** Sets the read receiver frequency /** Sets the read receiver frequency
if data required from receiver randomly readRxrFrequency=0, if data required from receiver randomly readRxrFrequency=0,