mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
changed users set/getDetectorsize API to include a single ROI
This commit is contained in:
parent
0d96272db5
commit
660ed4c177
@ -4533,7 +4533,9 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
|||||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||||
ret=myDet->setDynamicRange(val);
|
ret=myDet->setDynamicRange(val);
|
||||||
} else if (cmd=="roi") {
|
} else if (cmd=="roi") {
|
||||||
myDet->getROI(ret);
|
ROI* r = myDet->getROI(ret);
|
||||||
|
if (myDet->isMultiSlsDetectorClass() && r != NULL)
|
||||||
|
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));
|
||||||
return string(ans);
|
return string(ans);
|
||||||
@ -6995,7 +6997,8 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
os << hex << reg << dec;
|
os << hex << reg << dec;
|
||||||
|
if (myDet->isMultiSlsDetectorClass() && aa != NULL)
|
||||||
|
delete [] aa;
|
||||||
|
|
||||||
//os <<" "<< hex << myDet->readRegister(120) << dec;
|
//os <<" "<< hex << myDet->readRegister(120) << dec;
|
||||||
|
|
||||||
|
@ -115,17 +115,37 @@ int slsDetectorUsers::getPositions(double *pos){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::setDetectorSize(int x0, int y0, int nx, int ny){
|
int slsDetectorUsers::setDetectorSize(int x0, int y0, int nx, int ny){
|
||||||
if(myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y)>1)
|
// only one roi
|
||||||
return 1;
|
slsDetectorDefs::ROI roi[1];
|
||||||
int nmod=nx/(myDetector->getChansPerMod(0));
|
roi[0].xmin = x0;
|
||||||
cout << myDetector->getChansPerMod(0) << " " << nx << " " << nmod << endl;
|
roi[0].ymin = y0;
|
||||||
return myDetector->setNumberOfModules(nmod)*myDetector->getChansPerMod(0);}
|
roi[0].xmax = x0 + nx;
|
||||||
|
roi[0].ymax = y0 + ny;
|
||||||
|
return myDetector->setROI(1, roi);
|
||||||
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::getDetectorSize(int &x0, int &y0, int &nx, int &ny){
|
int slsDetectorUsers::getDetectorSize(int &x0, int &y0, int &nx, int &ny){
|
||||||
y0=0;
|
int n = 0;
|
||||||
x0=0;
|
slsDetectorDefs::ROI* roi = myDetector->getROI(n);
|
||||||
nx=myDetector->getTotalNumberOfChannels(slsDetectorDefs::X);
|
|
||||||
ny=myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y);
|
// roi
|
||||||
|
if (roi != NULL && n > 0) {
|
||||||
|
x0 = roi[0].xmin;
|
||||||
|
y0 = roi[0].ymin;
|
||||||
|
nx = roi[0].xmax - roi[0].xmin;
|
||||||
|
ny = roi[0].ymax - roi[0].ymin;
|
||||||
|
}
|
||||||
|
// no roi
|
||||||
|
else {
|
||||||
|
y0=0;
|
||||||
|
x0=0;
|
||||||
|
nx=myDetector->getTotalNumberOfChannels(slsDetectorDefs::X);
|
||||||
|
ny=myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roi != NULL)
|
||||||
|
delete [] roi;
|
||||||
|
|
||||||
return nx*ny;
|
return nx*ny;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ class slsDetectorUsers
|
|||||||
int getPositions(double *pos=NULL);
|
int getPositions(double *pos=NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short sets the detector size
|
@short sets the detector size (only 1 ROI) (not Mythen supported anymore)
|
||||||
\param x0 horizontal position origin in channel number (-1 unchanged)
|
\param x0 horizontal position origin in channel number (-1 unchanged)
|
||||||
\param y0 vertical position origin in channel number (-1 unchanged)
|
\param y0 vertical position origin in channel number (-1 unchanged)
|
||||||
\param nx number of channels in horiziontal (-1 unchanged)
|
\param nx number of channels in horiziontal (-1 unchanged)
|
||||||
@ -258,12 +258,12 @@ class slsDetectorUsers
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short gets detector size
|
@short gets detector size (not Mythen supported anymore)
|
||||||
\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
|
||||||
\param ny number of channels in vertical
|
\param ny number of channels in vertical
|
||||||
\returns OK/FAIL
|
\returns total number of channels
|
||||||
*/
|
*/
|
||||||
int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
|
int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user