mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
gotthard fixed roi only xmin and xmax.remove updateoffsets
This commit is contained in:
parent
2fe06c7163
commit
d4d8cbe9bc
@ -54,7 +54,7 @@
|
|||||||
<enum>QTabWidget::North</enum>
|
<enum>QTabWidget::North</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="elideMode">
|
<property name="elideMode">
|
||||||
<enum>Qt::ElideLeft</enum>
|
<enum>Qt::ElideLeft</enum>
|
||||||
@ -132,102 +132,20 @@
|
|||||||
<string>Region of Interest</string>
|
<string>Region of Interest</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="btnAddRoi">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>130</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string> Add ROI Slot </string>
|
<string>X Min:</string>
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../include/icons.qrc">
|
|
||||||
<normaloff>:/icons/images/add.png</normaloff>:/icons/images/add.png</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4">
|
<item row="1" column="8">
|
||||||
<widget class="QPushButton" name="btnGetRoi">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>130</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string> Get ROI </string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../include/icons.qrc">
|
|
||||||
<normaloff>:/icons/images/download.png</normaloff>:/icons/images/download.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<spacer name="horizontalSpacer_6">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="horizontalSpacer_7">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QPushButton" name="btnSetRoi">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>130</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string> Set ROI </string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../include/icons.qrc">
|
|
||||||
<normaloff>:/icons/images/upload.png</normaloff>:/icons/images/upload.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="6">
|
|
||||||
<widget class="QPushButton" name="btnClearRoi">
|
<widget class="QPushButton" name="btnClearRoi">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
@ -237,12 +155,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>130</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string> Clear ROI </string>
|
<string>Clear ROI </string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../include/icons.qrc">
|
<iconset resource="../include/icons.qrc">
|
||||||
@ -250,45 +168,159 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="5">
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinXmin">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>160</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1279</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="7">
|
||||||
<spacer name="horizontalSpacer_5">
|
<spacer name="horizontalSpacer_5">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="7">
|
<item row="1" column="3">
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="frameShape">
|
<property name="sizePolicy">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="widgetResizable">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string>X Max:</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="roiWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>735</width>
|
|
||||||
<height>235</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridRoi">
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>15</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QSpinBox" name="spinXmax">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>160</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1279</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Readout: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QPushButton" name="btnSetRoi">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>35</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Set ROI </string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../include/icons.qrc">
|
||||||
|
<normaloff>:/icons/images/refresh.png</normaloff>:/icons/images/refresh.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="5">
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="4">
|
||||||
|
<widget class="QComboBox" name="comboReadout">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>160</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -399,7 +431,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Detector Control Port:</string>
|
<string>Readout Control Port:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -910,7 +942,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Detector UDP MAC:</string>
|
<string>Readout UDP MAC:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -929,7 +961,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Detector:</string>
|
<string>Readout:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -968,7 +1000,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Detector UDP IP:</string>
|
<string>Readout UDP IP:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -981,7 +1013,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Detector Stop Port:</string>
|
<string>Readout Stop Port:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1402,11 +1434,11 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
|||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tabAdvancedSettings</tabstop>
|
<tabstop>tabAdvancedSettings</tabstop>
|
||||||
<tabstop>spinSetAllTrimbits</tabstop>
|
<tabstop>spinSetAllTrimbits</tabstop>
|
||||||
<tabstop>btnAddRoi</tabstop>
|
<tabstop>comboReadout</tabstop>
|
||||||
|
<tabstop>spinXmin</tabstop>
|
||||||
|
<tabstop>spinXmax</tabstop>
|
||||||
<tabstop>btnSetRoi</tabstop>
|
<tabstop>btnSetRoi</tabstop>
|
||||||
<tabstop>btnGetRoi</tabstop>
|
|
||||||
<tabstop>btnClearRoi</tabstop>
|
<tabstop>btnClearRoi</tabstop>
|
||||||
<tabstop>scrollArea</tabstop>
|
|
||||||
<tabstop>comboDetector</tabstop>
|
<tabstop>comboDetector</tabstop>
|
||||||
<tabstop>spinControlPort</tabstop>
|
<tabstop>spinControlPort</tabstop>
|
||||||
<tabstop>spinStopPort</tabstop>
|
<tabstop>spinStopPort</tabstop>
|
||||||
|
@ -29,7 +29,6 @@ private slots:
|
|||||||
void SetRxrUDPMAC();
|
void SetRxrUDPMAC();
|
||||||
void SetRxrZMQPort(int port);
|
void SetRxrZMQPort(int port);
|
||||||
void SetRxrZMQIP();
|
void SetRxrZMQIP();
|
||||||
void AddROISlot();
|
|
||||||
void GetROI();
|
void GetROI();
|
||||||
void ClearROI();
|
void ClearROI();
|
||||||
void SetROI();
|
void SetROI();
|
||||||
@ -56,22 +55,12 @@ private:
|
|||||||
void GetRxrUDPMAC();
|
void GetRxrUDPMAC();
|
||||||
void GetRxrZMQPort();
|
void GetRxrZMQPort();
|
||||||
void GetRxrZMQIP();
|
void GetRxrZMQIP();
|
||||||
void ClearROIWidgets();
|
|
||||||
void GetAllTrimbits();
|
void GetAllTrimbits();
|
||||||
void GetNumStoragecells();
|
void GetNumStoragecells();
|
||||||
void GetSubExposureTime();
|
void GetSubExposureTime();
|
||||||
void GetSubDeadTime();
|
void GetSubDeadTime();
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
/** ROI */
|
|
||||||
std::vector <QLabel*> lblFromX;
|
|
||||||
std::vector <QSpinBox*> spinFromX;
|
|
||||||
std::vector <QLabel*> lblFromY;
|
|
||||||
std::vector <QSpinBox*> spinFromY;
|
|
||||||
std::vector <QLabel*> lblToX;
|
|
||||||
std::vector <QSpinBox*> spinToX;
|
|
||||||
std::vector <QLabel*> lblToY;
|
|
||||||
std::vector <QSpinBox*> spinToY;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,18 +10,7 @@ qTabAdvanced::qTabAdvanced(QWidget *parent, multiSlsDetector *detector)
|
|||||||
FILE_LOG(logDEBUG) << "Advanced ready";
|
FILE_LOG(logDEBUG) << "Advanced ready";
|
||||||
}
|
}
|
||||||
|
|
||||||
qTabAdvanced::~qTabAdvanced() {
|
qTabAdvanced::~qTabAdvanced() {}
|
||||||
for (size_t i = 0; i < lblFromX.size(); ++i) {
|
|
||||||
delete lblFromX[i];
|
|
||||||
delete lblFromY[i];
|
|
||||||
delete lblToX[i];
|
|
||||||
delete lblToY[i];
|
|
||||||
delete spinFromX[i];
|
|
||||||
delete spinFromY[i];
|
|
||||||
delete spinToX[i];
|
|
||||||
delete spinToY[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabAdvanced::SetupWidgetWindow() {
|
void qTabAdvanced::SetupWidgetWindow() {
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
@ -93,9 +82,8 @@ void qTabAdvanced::Initialization() {
|
|||||||
|
|
||||||
// roi
|
// roi
|
||||||
if (tab_roi->isEnabled()) {
|
if (tab_roi->isEnabled()) {
|
||||||
connect(btnAddRoi, SIGNAL(clicked()), this, SLOT(AddROISlot()));
|
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||||
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI()));
|
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI()));
|
||||||
connect(btnGetRoi, SIGNAL(clicked()), this, SLOT(GetROI()));
|
|
||||||
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI()));
|
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,14 +110,20 @@ void qTabAdvanced::PopulateDetectors() {
|
|||||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||||
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetDetector(int)));
|
SLOT(SetDetector(int)));
|
||||||
|
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||||
|
|
||||||
comboDetector->clear();
|
comboDetector->clear();
|
||||||
for (unsigned int i = 0; i < myDet->size(); ++i)
|
comboReadout->clear();
|
||||||
|
for (unsigned int i = 0; i < myDet->size(); ++i) {
|
||||||
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
|
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
|
||||||
|
comboReadout->addItem(QString(myDet->getHostname(i).c_str()));
|
||||||
|
}
|
||||||
comboDetector->setCurrentIndex(0);
|
comboDetector->setCurrentIndex(0);
|
||||||
|
comboReadout->setCurrentIndex(0);
|
||||||
|
|
||||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetDetector(int)));
|
SLOT(SetDetector(int)));
|
||||||
|
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::GetControlPort() {
|
void qTabAdvanced::GetControlPort() {
|
||||||
@ -462,173 +456,33 @@ void qTabAdvanced::SetRxrZMQIP() {
|
|||||||
&qTabAdvanced::GetRxrZMQIP)
|
&qTabAdvanced::GetRxrZMQIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::AddROISlot() {
|
|
||||||
FILE_LOG(logDEBUG) << "Add ROI Slot";
|
|
||||||
|
|
||||||
QLabel *lFromX = new QLabel("x min:");
|
|
||||||
QLabel *lFromY = new QLabel("y min:");
|
|
||||||
QLabel *lToX = new QLabel("x max:");
|
|
||||||
QLabel *lToY = new QLabel("y max:");
|
|
||||||
QSpinBox *sFromX = new QSpinBox();
|
|
||||||
QSpinBox *sFromY = new QSpinBox();
|
|
||||||
QSpinBox *sToX = new QSpinBox();
|
|
||||||
QSpinBox *sToY = new QSpinBox();
|
|
||||||
lFromX->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
lFromY->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
lToX->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
lToY->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
sFromX->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
sFromY->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
sToX->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
sToY->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
lFromX->setFixedWidth(50);
|
|
||||||
lFromY->setFixedWidth(50);
|
|
||||||
lToX->setFixedWidth(50);
|
|
||||||
lToY->setFixedWidth(50);
|
|
||||||
sFromX->setFixedWidth(80);
|
|
||||||
sFromY->setFixedWidth(80);
|
|
||||||
sToX->setFixedWidth(80);
|
|
||||||
sToY->setFixedWidth(80);
|
|
||||||
sFromX->setFixedHeight(19);
|
|
||||||
sFromY->setFixedHeight(19);
|
|
||||||
sToX->setFixedHeight(19);
|
|
||||||
sToY->setFixedHeight(19);
|
|
||||||
sFromX->setMaximum(myDet->getTotalNumberOfChannels(slsDetectorDefs::X) - 1);
|
|
||||||
sToX->setMaximum(myDet->getTotalNumberOfChannels(slsDetectorDefs::X) - 1);
|
|
||||||
sFromY->setMaximum(myDet->getTotalNumberOfChannels(slsDetectorDefs::Y) - 1);
|
|
||||||
sToY->setMaximum(myDet->getTotalNumberOfChannels(slsDetectorDefs::Y) - 1);
|
|
||||||
sFromX->setMinimum(-1);
|
|
||||||
sToX->setMinimum(-1);
|
|
||||||
sFromY->setMinimum(-1);
|
|
||||||
sToY->setMinimum(-1);
|
|
||||||
sFromX->setValue(-1);
|
|
||||||
sFromY->setValue(-1);
|
|
||||||
sToX->setValue(-1);
|
|
||||||
sToY->setValue(-1);
|
|
||||||
|
|
||||||
lblFromX.push_back(lFromX);
|
|
||||||
lblFromY.push_back(lFromY);
|
|
||||||
lblToX.push_back(lToX);
|
|
||||||
lblToY.push_back(lToY);
|
|
||||||
spinFromX.push_back(sFromX);
|
|
||||||
spinFromY.push_back(sFromY);
|
|
||||||
spinToX.push_back(sToX);
|
|
||||||
spinToY.push_back(sToY);
|
|
||||||
|
|
||||||
int nroi = (int)lblFromX.size();
|
|
||||||
gridRoi->addWidget(lblFromX[nroi], nroi, 0, Qt::AlignTop);
|
|
||||||
gridRoi->addWidget(spinFromX[nroi], nroi, 1, Qt::AlignTop);
|
|
||||||
// FIXME: gridRoi->addItem(new
|
|
||||||
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
|
|
||||||
// nroi,2,Qt::AlignTop);
|
|
||||||
gridRoi->addWidget(lblToX[nroi], nroi, 3, Qt::AlignTop);
|
|
||||||
gridRoi->addWidget(spinToX[nroi], nroi, 4, Qt::AlignTop);
|
|
||||||
// FIXME: gridRoi->addItem(new
|
|
||||||
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
|
|
||||||
// nroi,5,Qt::AlignTop);
|
|
||||||
gridRoi->addWidget(lblFromY[nroi], nroi, 6, Qt::AlignTop);
|
|
||||||
gridRoi->addWidget(spinFromY[nroi], nroi, 7, Qt::AlignTop);
|
|
||||||
// FIXME: gridRoi->addItem(new
|
|
||||||
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
|
|
||||||
// nroi,8,Qt::AlignTop);
|
|
||||||
gridRoi->addWidget(lblToY[nroi], nroi, 9, Qt::AlignTop);
|
|
||||||
gridRoi->addWidget(spinToY[nroi], nroi, 10, Qt::AlignTop);
|
|
||||||
|
|
||||||
lblFromX[nroi]->show();
|
|
||||||
spinFromX[nroi]->show();
|
|
||||||
lblToX[nroi]->show();
|
|
||||||
spinToX[nroi]->show();
|
|
||||||
lblFromY[nroi]->show();
|
|
||||||
spinFromY[nroi]->show();
|
|
||||||
lblToY[nroi]->show();
|
|
||||||
spinToY[nroi]->show();
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG) << "ROI Inputs added";
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabAdvanced::GetROI() {
|
void qTabAdvanced::GetROI() {
|
||||||
FILE_LOG(logDEBUG) << "Getting ROI";
|
FILE_LOG(logDEBUG) << "Getting ROI";
|
||||||
ClearROIWidgets();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int nroi = 0;
|
slsDetectorDefs::ROI roi = myDet->getROI(comboReadout->currentIndex());
|
||||||
const slsDetectorDefs::ROI *roi = myDet->getROI(nroi);
|
spinXmin->setValue(roi.xmin);
|
||||||
if (roi != nullptr) {
|
spinXmax->setValue(roi.xmax);
|
||||||
for (int i = 0; i < nroi; ++i) {
|
|
||||||
AddROISlot();
|
|
||||||
spinFromX[i]->setValue(roi[i].xmin);
|
|
||||||
spinFromY[i]->setValue(roi[i].ymin);
|
|
||||||
spinToX[i]->setValue(roi[i].xmax);
|
|
||||||
spinToY[i]->setValue(roi[i].ymax);
|
|
||||||
}
|
|
||||||
FILE_LOG(logDEBUG) << "ROIs populated: " << nroi;
|
|
||||||
}
|
|
||||||
|
|
||||||
} CATCH_DISPLAY ("Could not get ROI.", "qTabAdvanced::GetROI")
|
} CATCH_DISPLAY ("Could not get ROI.", "qTabAdvanced::GetROI")
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::ClearROIWidgets() {
|
|
||||||
FILE_LOG(logDEBUG) << "Clear ROI Widgets";
|
|
||||||
|
|
||||||
// hide widgets
|
|
||||||
QLayoutItem *item;
|
|
||||||
while ((item = gridRoi->takeAt(0))) {
|
|
||||||
if (item->widget()) {
|
|
||||||
item->widget()->hide();
|
|
||||||
gridRoi->removeWidget(item->widget());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete widgets
|
|
||||||
for (size_t i = 0; i < lblFromX.size(); ++i) {
|
|
||||||
delete lblFromX[i];
|
|
||||||
delete spinFromX[i];
|
|
||||||
delete lblToX[i];
|
|
||||||
delete spinToY[i];
|
|
||||||
delete lblFromY[i];
|
|
||||||
delete spinFromY[i];
|
|
||||||
delete lblToY[i];
|
|
||||||
delete spinToY[i];
|
|
||||||
}
|
|
||||||
lblFromX.clear();
|
|
||||||
spinFromX.clear();
|
|
||||||
lblToX.clear();
|
|
||||||
spinToY.clear();
|
|
||||||
lblFromY.clear();
|
|
||||||
spinFromY.clear();
|
|
||||||
lblToY.clear();
|
|
||||||
spinToY.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabAdvanced::ClearROI() {
|
void qTabAdvanced::ClearROI() {
|
||||||
FILE_LOG(logINFO) << "Clearing ROI";
|
FILE_LOG(logINFO) << "Clearing ROI";
|
||||||
if (QMessageBox::warning(
|
spinXmin->setValue(-1);
|
||||||
this, "Clear ROI",
|
spinXmax->setValue(-1);
|
||||||
"Are you sure you want to clear all the ROI in detector?",
|
|
||||||
QMessageBox::Yes | QMessageBox::No,
|
|
||||||
QMessageBox::No) == QMessageBox::Yes) {
|
|
||||||
|
|
||||||
ClearROIWidgets();
|
|
||||||
SetROI();
|
SetROI();
|
||||||
FILE_LOG(logDEBUG) << "ROIs cleared";
|
FILE_LOG(logDEBUG) << "ROIs cleared";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetROI() {
|
void qTabAdvanced::SetROI() {
|
||||||
// get roi from widgets
|
|
||||||
int nroi = (int)lblFromX.size();
|
slsDetectorDefs::ROI roi;
|
||||||
slsDetectorDefs::ROI roi[nroi];
|
roi.xmin = spinXmin->value();
|
||||||
for (int i = 0; i < nroi; ++i) {
|
roi.xmax = spinXmax->value();
|
||||||
roi[i].xmin = spinFromX[i]->value();
|
|
||||||
roi[i].ymin = spinFromY[i]->value();
|
|
||||||
roi[i].xmax = spinToX[i]->value();
|
|
||||||
roi[i].ymax = spinToY[i]->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
// set roi
|
// set roi
|
||||||
FILE_LOG(logINFO) << "Setting ROI:" << nroi;
|
FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
|
||||||
try {
|
try {
|
||||||
myDet->setROI(nroi, roi, -1);
|
myDet->setROI(roi, comboReadout->currentIndex());
|
||||||
} CATCH_DISPLAY ("Could not set these ROIs.",
|
} CATCH_DISPLAY ("Could not set these ROIs.",
|
||||||
"qTabAdvanced::SetROI")
|
"qTabAdvanced::SetROI")
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -37,8 +37,7 @@ int digitalTestBit = 0;
|
|||||||
|
|
||||||
// roi configuration
|
// roi configuration
|
||||||
int adcConfigured = -1;
|
int adcConfigured = -1;
|
||||||
ROI rois[MAX_ROIS];
|
ROI rois;
|
||||||
int nROI = 0;
|
|
||||||
int ipPacketSize = 0;
|
int ipPacketSize = 0;
|
||||||
int udpPacketSize = 0;
|
int udpPacketSize = 0;
|
||||||
|
|
||||||
@ -397,7 +396,9 @@ void setupDetector() {
|
|||||||
bus_w(TEMP_SPI_OUT_REG, 0x0);
|
bus_w(TEMP_SPI_OUT_REG, 0x0);
|
||||||
|
|
||||||
// roi, gbit readout
|
// roi, gbit readout
|
||||||
setROIADC(-1); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
|
rois.xmin = -1;
|
||||||
|
rois.xmax = -1;
|
||||||
|
setROI(rois);// set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
|
||||||
setGbitReadout();
|
setGbitReadout();
|
||||||
|
|
||||||
// master, slave (25um)
|
// master, slave (25um)
|
||||||
@ -726,95 +727,49 @@ int setDynamicRange(int dr){
|
|||||||
return DYNAMIC_RANGE;
|
return DYNAMIC_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret) {
|
int setROI(ROI arg) {
|
||||||
|
|
||||||
// set ROI
|
|
||||||
if(n >= 0){
|
|
||||||
// print
|
|
||||||
if (!n) {
|
|
||||||
FILE_LOG(logINFO, ("Clearing ROI\n"));
|
|
||||||
} else {
|
|
||||||
FILE_LOG(logINFO, ("Setting ROI:\n"));
|
|
||||||
int i = 0;
|
|
||||||
for (i = 0; i < n; ++i) {
|
|
||||||
FILE_LOG(logINFO, ("\t(%d, %d)\n", arg[i].xmin, arg[i].xmax));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// only one ROI allowed per module
|
|
||||||
if (n > 1) {
|
|
||||||
FILE_LOG(logERROR, ("\tCannot set more than 1 ROI per module\n"));
|
|
||||||
*ret = FAIL;
|
|
||||||
*retvalsize = nROI;
|
|
||||||
return rois;
|
|
||||||
}
|
|
||||||
|
|
||||||
//clear all rois
|
|
||||||
nROI = 0;
|
|
||||||
|
|
||||||
// find adc number and recorrect channel limits
|
|
||||||
int adc = -1;
|
int adc = -1;
|
||||||
if (n) {
|
if (arg.xmin == -1) {
|
||||||
// all channels
|
FILE_LOG(logINFO, ("Clearing ROI\n"));
|
||||||
if ((arg[0].xmin <= 0) && (arg[0].xmax >= NCHIP * NCHAN))
|
rois.xmin = -1;
|
||||||
adc = -1;
|
rois.xmax = -1;
|
||||||
// single adc
|
} else {
|
||||||
else {
|
FILE_LOG(logINFO, ("Setting ROI:(%d, %d)\n", arg.xmin, arg.xmax));
|
||||||
//adc = mid value/numchans
|
// validation
|
||||||
adc = ((((arg[0].xmax) + (arg[0].xmin))/2) / (NCHAN * NCHIPS_PER_ADC));
|
// xmin divisible by 256 and less than 1280
|
||||||
// incorrect adc
|
if (((arg.xmin % NCHAN_PER_ADC) != 0) || (arg.xmin >= (NCHAN * NCHIP))) {
|
||||||
if((adc < 0) || (adc > 4)) {
|
FILE_LOG(logERROR, ("Could not set roi. xmin is invalid\n"));
|
||||||
FILE_LOG(logERROR, ("\tadc value greater than 5. deleting roi\n"));
|
return FAIL;
|
||||||
adc = -1;
|
|
||||||
}
|
}
|
||||||
// recorrect roi values
|
// xmax must be 255 more than xmin
|
||||||
else {
|
if (arg.xmax != (arg.xmin + NCHAN_PER_ADC - 1)) {
|
||||||
rois[0].xmin = adc * (NCHAN * NCHIPS_PER_ADC);
|
FILE_LOG(logERROR, ("Could not set roi. xmax is invalid\n"));
|
||||||
rois[0].xmax = (adc + 1) * (NCHAN * NCHIPS_PER_ADC) - 1;
|
return FAIL;
|
||||||
rois[0].ymin = -1;
|
|
||||||
rois[0].ymax = -1;
|
|
||||||
nROI = 1;
|
|
||||||
}
|
}
|
||||||
|
rois.xmin = arg.xmin;
|
||||||
|
rois.xmax = arg.xmax;
|
||||||
|
adc = arg.xmin / NCHAN_PER_ADC;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (adc == -1)
|
|
||||||
nROI = 0;
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tAdc to be configured: %d\n", adc));
|
FILE_LOG(logINFO, ("\tAdc to be configured: %d\n", adc));
|
||||||
FILE_LOG(logINFO, ("\tROI to be configured: (%d, %d)\n",
|
FILE_LOG(logINFO, ("\tROI to be configured: (%d, %d)\n",
|
||||||
(adc == -1) ? 0 : (rois[0].xmin),
|
(adc == -1) ? 0 : (rois.xmin),
|
||||||
(adc == -1) ? (NCHIP * NCHAN - 1) : (rois[0].xmax)));
|
(adc == -1) ? (NCHIP * NCHAN - 1) : (rois.xmax)));
|
||||||
|
|
||||||
// could not set roi
|
|
||||||
if((n != 0) && ((arg[0].xmin != rois[0].xmin)||
|
|
||||||
(arg[0].xmax != rois[0].xmax)||
|
|
||||||
(arg[0].ymin != rois[0].ymin)||
|
|
||||||
(arg[0].ymax != rois[0].ymax))) {
|
|
||||||
*ret = FAIL;
|
|
||||||
FILE_LOG(logERROR, ("\tCould not set given ROI\n"));
|
|
||||||
}
|
|
||||||
if(n != nROI) {
|
|
||||||
*ret = FAIL;
|
|
||||||
FILE_LOG(logERROR, ("\tCould not set or clear ROIs\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
//set adc of interest
|
//set adc of interest
|
||||||
setROIADC(adc);
|
setROIADC(adc);
|
||||||
} else FILE_LOG(logINFO, ("Getting ROI:\n"));
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ROI getROI() {
|
||||||
|
FILE_LOG(logINFO, ("Getting ROI:\n"));
|
||||||
|
|
||||||
// print
|
// print
|
||||||
if (!nROI) {
|
if (rois.xmin == -1) {
|
||||||
FILE_LOG(logINFO, ("\tROI: None\n"));
|
FILE_LOG(logINFO, ("\tROI: None\n"));
|
||||||
} else {
|
} else {
|
||||||
FILE_LOG(logINFO, ("ROI:\n"));
|
FILE_LOG(logINFO, ("ROI: (%d,%d)\n", rois.xmin, rois.xmax));
|
||||||
int i = 0;
|
|
||||||
for (i = 0; i < nROI; ++i) {
|
|
||||||
FILE_LOG(logINFO, ("\t(%d, %d)\n", rois[i].xmin, rois[i].xmax));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
*retvalsize = nROI;
|
|
||||||
return rois;
|
return rois;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ enum DACINDEX {VREF_DS, VCASCN_PB, VCASCP_PB, VOUT_CM, VCASC_OUT, VIN
|
|||||||
#define NCHIP (10)
|
#define NCHIP (10)
|
||||||
#define NDAC (8)
|
#define NDAC (8)
|
||||||
#define NCHIPS_PER_ADC (2)
|
#define NCHIPS_PER_ADC (2)
|
||||||
|
#define NCHAN_PER_ADC (256)
|
||||||
#define DYNAMIC_RANGE (16)
|
#define DYNAMIC_RANGE (16)
|
||||||
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
|
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
|
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
|
||||||
|
@ -114,7 +114,8 @@ void resetPeripheral();
|
|||||||
// parameters - dr, roi
|
// parameters - dr, roi
|
||||||
int setDynamicRange(int dr);
|
int setDynamicRange(int dr);
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
int setROI(ROI arg);
|
||||||
|
ROI getROI();
|
||||||
#endif
|
#endif
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
int setADCEnableMask(uint32_t mask);
|
int setADCEnableMask(uint32_t mask);
|
||||||
|
@ -189,6 +189,7 @@ const char* getFunctionName(enum detFuncs func) {
|
|||||||
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
|
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
|
||||||
case F_SET_READOUT_FLAGS: return "F_SET_READOUT_FLAGS";
|
case F_SET_READOUT_FLAGS: return "F_SET_READOUT_FLAGS";
|
||||||
case F_SET_ROI: return "F_SET_ROI";
|
case F_SET_ROI: return "F_SET_ROI";
|
||||||
|
case F_GET_ROI: return "F_GET_ROI";
|
||||||
case F_SET_SPEED: return "F_SET_SPEED";
|
case F_SET_SPEED: return "F_SET_SPEED";
|
||||||
case F_EXIT_SERVER: return "F_EXIT_SERVER";
|
case F_EXIT_SERVER: return "F_EXIT_SERVER";
|
||||||
case F_LOCK_SERVER: return "F_LOCK_SERVER";
|
case F_LOCK_SERVER: return "F_LOCK_SERVER";
|
||||||
@ -279,6 +280,7 @@ void function_table() {
|
|||||||
flist[F_SET_DYNAMIC_RANGE] = &set_dynamic_range;
|
flist[F_SET_DYNAMIC_RANGE] = &set_dynamic_range;
|
||||||
flist[F_SET_READOUT_FLAGS] = &set_readout_flags;
|
flist[F_SET_READOUT_FLAGS] = &set_readout_flags;
|
||||||
flist[F_SET_ROI] = &set_roi;
|
flist[F_SET_ROI] = &set_roi;
|
||||||
|
flist[F_GET_ROI] = &get_roi;
|
||||||
flist[F_SET_SPEED] = &set_speed;
|
flist[F_SET_SPEED] = &set_speed;
|
||||||
flist[F_EXIT_SERVER] = &exit_server;
|
flist[F_EXIT_SERVER] = &exit_server;
|
||||||
flist[F_LOCK_SERVER] = &lock_server;
|
flist[F_LOCK_SERVER] = &lock_server;
|
||||||
@ -1896,76 +1898,49 @@ int set_readout_flags(int file_des) {
|
|||||||
int set_roi(int file_des) {
|
int set_roi(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int narg = -1;
|
ROI arg;
|
||||||
ROI arg[MAX_ROIS];
|
|
||||||
int nretval = -1;
|
|
||||||
ROI* retval = NULL;
|
|
||||||
|
|
||||||
// receive number of ROIs
|
// receive ROI
|
||||||
if (receiveData(file_des, &narg, sizeof(narg), INT32) < 0)
|
if (receiveData(file_des, &arg.xmin, sizeof(int), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
// receive ROIs
|
if (receiveData(file_des, &arg.xmax, sizeof(int), INT32) < 0)
|
||||||
{
|
|
||||||
int iloop = 0;
|
|
||||||
for (iloop = 0; iloop < narg; ++iloop) {
|
|
||||||
if (receiveData(file_des, &arg[iloop].xmin, sizeof(int), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
if (receiveData(file_des, &arg[iloop].xmax, sizeof(int), INT32) < 0)
|
FILE_LOG(logDEBUG1, ("Set ROI: [%d, %d]\n", arg.xmin, arg.xmax));
|
||||||
return printSocketReadError();
|
|
||||||
if (receiveData(file_des, &arg[iloop].ymin, sizeof(int), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
if (receiveData(file_des, &arg[iloop].ymax, sizeof(int), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FILE_LOG(logDEBUG1, ("Set ROI (narg:%d)\n", narg));
|
|
||||||
{
|
|
||||||
int iloop = 0;
|
|
||||||
for (iloop = 0; iloop < narg; ++iloop) {
|
|
||||||
FILE_LOG(logDEBUG1, ("%d: %d\t%d\t%d\t%d\n",
|
|
||||||
arg[iloop].xmin, arg[iloop].xmax, arg[iloop].ymin, arg[iloop].ymax));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef GOTTHARDD
|
#ifndef GOTTHARDD
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// set & get
|
// only set
|
||||||
if ((narg == GET_READOUT_FLAGS) || (Server_VerifyLock() == OK)) {
|
if (Server_VerifyLock() == OK) {
|
||||||
if (myDetectorType == GOTTHARD && narg > 1) {
|
ret = setROI(arg);
|
||||||
ret = FAIL;
|
|
||||||
strcpy(mess,"Can not set more than one ROI per module.\n");
|
|
||||||
FILE_LOG(logERROR,(mess));
|
|
||||||
} else {
|
|
||||||
retval = setROI(narg, arg, &nretval, &ret);
|
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
if (nretval == -1) // chip test board
|
sprintf(mess, "Could not set ROI. Invalid xmin or xmax\n");
|
||||||
sprintf(mess,"Could not set ROI. Max ROI level (100) reached!\n");
|
|
||||||
else if (nretval == -2)
|
|
||||||
sprintf(mess, "Could not set ROI. Could not allocate RAM\n");
|
|
||||||
else
|
|
||||||
sprintf(mess,"Could not set all roi. "
|
|
||||||
"Set %d rois, but read %d rois\n", narg, nretval);
|
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG1, ("nRois: %d\n", nretval));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int get_roi(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
ROI retval;
|
||||||
|
|
||||||
|
#ifndef GOTTHARDD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only get
|
||||||
|
retval = getROI();
|
||||||
|
FILE_LOG(logDEBUG1, ("nRois: (%d, %d)\n", retval.xmin, retval.xmax));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||||
if (ret != FAIL) {
|
if (ret != FAIL) {
|
||||||
//retvalsize could be swapped during sendData
|
sendData(file_des, &retval.xmin, sizeof(int), INT32);
|
||||||
int nretval1 = nretval;
|
sendData(file_des, &retval.xmax, sizeof(int), INT32);
|
||||||
sendData(file_des, &nretval1, sizeof(nretval1), INT32);
|
|
||||||
int iloop = 0;
|
|
||||||
for(iloop = 0; iloop < nretval; ++iloop) {
|
|
||||||
sendData(file_des, &retval[iloop].xmin, sizeof(int), INT32);
|
|
||||||
sendData(file_des, &retval[iloop].xmax, sizeof(int), INT32);
|
|
||||||
sendData(file_des, &retval[iloop].ymin, sizeof(int), INT32);
|
|
||||||
sendData(file_des, &retval[iloop].ymax, sizeof(int), INT32);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1973,7 +1948,6 @@ int set_roi(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int set_speed(int file_des) {
|
int set_speed(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
@ -2284,20 +2258,9 @@ int send_update(int file_des) {
|
|||||||
|
|
||||||
// roi
|
// roi
|
||||||
#if defined(GOTTHARDD)
|
#if defined(GOTTHARDD)
|
||||||
ROI* retval = NULL;
|
ROI retval = getROI();
|
||||||
ROI arg[1];
|
sendData(file_des, &retval.xmin, sizeof(int), INT32);
|
||||||
int ret = OK, nretval = 0;
|
sendData(file_des, &retval.xmax, sizeof(int), INT32);
|
||||||
retval = setROI(-1, arg, &nretval, &ret);
|
|
||||||
//retvalsize could be swapped during sendData
|
|
||||||
int nretval1 = nretval;
|
|
||||||
sendData(file_des, &nretval1, sizeof(nretval1), INT32);
|
|
||||||
int iloop = 0;
|
|
||||||
for(iloop = 0; iloop < nretval; ++iloop) {
|
|
||||||
sendData(file_des, &retval[iloop].xmin, sizeof(int), INT32);
|
|
||||||
sendData(file_des, &retval[iloop].xmax, sizeof(int), INT32);
|
|
||||||
sendData(file_des, &retval[iloop].ymin, sizeof(int), INT32);
|
|
||||||
sendData(file_des, &retval[iloop].ymax, sizeof(int), INT32);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
|
@ -49,6 +49,7 @@ int get_time_left(int);
|
|||||||
int set_dynamic_range(int);
|
int set_dynamic_range(int);
|
||||||
int set_readout_flags(int);
|
int set_readout_flags(int);
|
||||||
int set_roi(int);
|
int set_roi(int);
|
||||||
|
int get_roi(int);
|
||||||
int set_speed(int);
|
int set_speed(int);
|
||||||
int exit_server(int);
|
int exit_server(int);
|
||||||
int lock_server(int);
|
int lock_server(int);
|
||||||
|
@ -82,16 +82,10 @@ class Detector {
|
|||||||
/**
|
/**
|
||||||
* Sets the maximum number of channels of complete detector in both
|
* Sets the maximum number of channels of complete detector in both
|
||||||
* dimensions. -1 means no limit in this dimension. This value is used to
|
* dimensions. -1 means no limit in this dimension. This value is used to
|
||||||
* calculate row and column offsets for each module.
|
* calculate row and column channels for each module.
|
||||||
*/
|
*/
|
||||||
void setMaxNumberOfChannels(const defs::coordinates value);
|
void setMaxNumberOfChannels(const defs::coordinates value);
|
||||||
|
|
||||||
/** [Gotthard] */
|
|
||||||
Result<defs::coordinates> getDetectorOffsets(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Gotthard] */
|
|
||||||
void setDetectorOffsets(defs::coordinates value, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Eiger with specific quad hardware] */
|
/** [Eiger with specific quad hardware] */
|
||||||
Result<bool> getQuad(Positions pos = {}) const;
|
Result<bool> getQuad(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -664,15 +658,16 @@ class Detector {
|
|||||||
/** [Eiger] If it is set, it resets chips completely (else partially) before an acquisition TODO: if it makes sense */
|
/** [Eiger] If it is set, it resets chips completely (else partially) before an acquisition TODO: if it makes sense */
|
||||||
void setCounterBit(bool value, Positions pos = {});
|
void setCounterBit(bool value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard, CTB]*/
|
/** [Gotthard]*/
|
||||||
Result<std::vector<defs::ROI>> getROI(Positions pos = {}) const;
|
Result<defs::ROI> getROI(Positions pos = {}) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Gotthard Options: Only a single chip or all chips, only 1 ROI allowed]
|
* [Gotthard]
|
||||||
* [CTB: multiple ROIs allowed]
|
* Options: Only a single ROI per module
|
||||||
* subset modules not allowed
|
* Can set only a single ROI at a time
|
||||||
|
* @param module position index
|
||||||
*/
|
*/
|
||||||
void setROI(std::vector<defs::ROI> value, Positions pos = {});
|
void setROI(defs::ROI value, int moduleId);
|
||||||
|
|
||||||
/** [CTB]*/
|
/** [CTB]*/
|
||||||
Result<uint32_t> getADCEnableMask(Positions pos = {}) const;
|
Result<uint32_t> getADCEnableMask(Positions pos = {}) const;
|
||||||
|
@ -65,16 +65,6 @@ struct sharedMultiSlsDetector {
|
|||||||
/** total number of channels including gap pixels in one dimension */
|
/** total number of channels including gap pixels in one dimension */
|
||||||
int numberOfChannelInclGapPixels[2];
|
int numberOfChannelInclGapPixels[2];
|
||||||
|
|
||||||
/** total number of channels for all detectors */
|
|
||||||
int maxNumberOfChannels;
|
|
||||||
|
|
||||||
/** max number of channels for all detectors in one dimension*/
|
|
||||||
int maxNumberOfChannel[2];
|
|
||||||
|
|
||||||
/** max number of channels including gap pixels for all detectors in
|
|
||||||
* one dimension*/
|
|
||||||
int maxNumberOfChannelInclGapPixels[2];
|
|
||||||
|
|
||||||
/** max number of channels allowed for the complete set of detectors in
|
/** max number of channels allowed for the complete set of detectors in
|
||||||
* one dimension */
|
* one dimension */
|
||||||
int maxNumberOfChannelsPerDetector[2];
|
int maxNumberOfChannelsPerDetector[2];
|
||||||
@ -432,8 +422,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum number of channels of all sls detectors in each
|
* Returns the maximum number of channels of all sls detectors in each
|
||||||
* dimension d from shared memory. multi detector shared memory variable to
|
* dimension d from shared memory.
|
||||||
* calculate offsets for each sls detector
|
|
||||||
* @param d dimension d
|
* @param d dimension d
|
||||||
* @returns the maximum number of channels of all sls detectors in dimension
|
* @returns the maximum number of channels of all sls detectors in dimension
|
||||||
* d
|
* d
|
||||||
@ -442,8 +431,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum number of channels of all sls detectors in each
|
* Sets the maximum number of channels of all sls detectors in each
|
||||||
* dimension d from shared memory, multi detector shared memory variable to
|
* dimension d from shared memory
|
||||||
* calculate offsets for each sls detector
|
|
||||||
* @param d dimension d
|
* @param d dimension d
|
||||||
* @param i maximum number of channels for multi structure in dimension d
|
* @param i maximum number of channels for multi structure in dimension d
|
||||||
* @returns the maximum number of channels of all sls detectors in dimension
|
* @returns the maximum number of channels of all sls detectors in dimension
|
||||||
@ -453,37 +441,18 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns maximum number of channels of all sls detectors in each
|
* Returns maximum number of channels of all sls detectors in each
|
||||||
* dimension d from shared memory, multi detector shared memory variable to
|
* dimension d from shared memory
|
||||||
* calculate offsets for each sls detector
|
|
||||||
* @returns maximum number of channels of all sls detectors
|
* @returns maximum number of channels of all sls detectors
|
||||||
*/
|
*/
|
||||||
slsDetectorDefs::coordinates getMaxNumberOfChannels() const; //
|
slsDetectorDefs::coordinates getMaxNumberOfChannels() const; //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets maximum number of channels of all sls detectors in each
|
* Sets maximum number of channels of all sls detectors in each
|
||||||
* dimension d from shared memory, multi detector shared memory variable to
|
* dimension d from shared memory
|
||||||
* calculate offsets for each sls detector
|
|
||||||
* @param c maximum number of channels of all sls detectors
|
* @param c maximum number of channels of all sls detectors
|
||||||
*/
|
*/
|
||||||
void setMaxNumberOfChannels(const slsDetectorDefs::coordinates c); //
|
void setMaxNumberOfChannels(const slsDetectorDefs::coordinates c); //
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Detector offset from shared memory in dimension d
|
|
||||||
* @param d dimension d
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
* @returns offset in dimension d, -1 if pos is not an actual position in
|
|
||||||
* list
|
|
||||||
*/
|
|
||||||
int getDetectorOffset(dimension d, int detPos = -1); //
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Detector offset in shared memory in dimension d
|
|
||||||
* @param d dimension d
|
|
||||||
* @param off offset for detector
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
*/
|
|
||||||
void setDetectorOffset(dimension d, int off, int detPos = -1);//
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Quad Type (Only for Eiger Quad detector hardware)
|
* Get Quad Type (Only for Eiger Quad detector hardware)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
@ -1376,22 +1345,27 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
int setCounterBit(int i = -1, int detPos = -1); //
|
int setCounterBit(int i = -1, int detPos = -1); //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ROI (Gotthard)
|
* Clear ROI (Gotthard)
|
||||||
* At the moment only one set allowed
|
|
||||||
* @param n number of rois
|
|
||||||
* @param roiLimits array of roi
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
*/
|
*/
|
||||||
void setROI(int n = -1, ROI roiLimits[] = nullptr, int detPos = -1);
|
void clearROI(int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ROI from each detector and convert it to the multi detector scale
|
* Set ROI (Gotthard)
|
||||||
* (Gotthard)
|
* At the moment only one set allowed per module
|
||||||
* @param n number of rois
|
* Only allowed to set one ROI per module
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param arg roi
|
||||||
* @returns OK or FAIL
|
* @param detPos specific detector position
|
||||||
*/
|
*/
|
||||||
const ROI *getROI(int &n, int detPos = -1);
|
void setROI(slsDetectorDefs::ROI arg, int detPos = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get ROI (Gotthard)
|
||||||
|
* Only allowed to set one ROI per module
|
||||||
|
* @param detPos specific detector position
|
||||||
|
* @returns roi
|
||||||
|
*/
|
||||||
|
slsDetectorDefs::ROI getROI(int detPos) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ADC Enable Mask (CTB, Moench)
|
* Set ADC Enable Mask (CTB, Moench)
|
||||||
@ -2187,14 +2161,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
void initializeMembers(bool verify = true);
|
void initializeMembers(bool verify = true);
|
||||||
|
|
||||||
/**
|
|
||||||
* Appends detectors to the end of the list in shared memory
|
|
||||||
* Connects to them
|
|
||||||
* @param name concatenated hostname of the sls detectors to be appended to
|
|
||||||
* the list
|
|
||||||
*/
|
|
||||||
void addMultipleDetectors(const char *name);//
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update user details in detector structure
|
* Update user details in detector structure
|
||||||
*/
|
*/
|
||||||
@ -2206,23 +2172,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
bool isAcquireReady();
|
bool isAcquireReady();
|
||||||
|
|
||||||
/**
|
|
||||||
* Decodes which detector and the corresponding channel numbers for it
|
|
||||||
* Mainly useful in a multi detector setROI (Gotthard)
|
|
||||||
* @param offsetX channel number or total channel offset in x direction
|
|
||||||
* @param offsetY channel number or total channel offset in y direction
|
|
||||||
* @param channelX channel number from detector offset in x direction
|
|
||||||
* @param channelY channel number from detector offset in x direction
|
|
||||||
* @returns detector id or -1 if channel number out of range
|
|
||||||
*/
|
|
||||||
int decodeNChannel(int offsetX, int offsetY, int &channelX, int &channelY);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the channel offsets in X and Y dimension for all the sls
|
|
||||||
* detectors It is required for decodeNMod and setting ROI
|
|
||||||
*/
|
|
||||||
void updateOffsets();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute in command line and return result
|
* Execute in command line and return result
|
||||||
* @param cmd command
|
* @param cmd command
|
||||||
@ -2230,12 +2179,26 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
std::string exec(const char *cmd);
|
std::string exec(const char *cmd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends detectors to the end of the list in shared memory
|
||||||
|
* Connects to them
|
||||||
|
* @param name concatenated hostname of the sls detectors to be appended to
|
||||||
|
* the list
|
||||||
|
*/
|
||||||
|
void addMultipleDetectors(const char *name);//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add sls detector
|
* Add sls detector
|
||||||
* @param s hostname of the single detector
|
* @param s hostname of the single detector
|
||||||
*/
|
*/
|
||||||
void addSlsDetector(const std::string &hostname);
|
void addSlsDetector(const std::string &hostname);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the channel size in X and Y dimension for all the sls
|
||||||
|
* detectors
|
||||||
|
*/
|
||||||
|
void updateDetectorSize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* increments file index
|
* increments file index
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
@ -2243,13 +2206,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
int incrementFileIndex(int detPos = -1);
|
int incrementFileIndex(int detPos = -1);
|
||||||
|
|
||||||
/**
|
|
||||||
* Ensures that min is less than max in both dimensions (Gotthard)
|
|
||||||
* @param n number of rois
|
|
||||||
* @param r array of rois
|
|
||||||
*/
|
|
||||||
void verifyMinMaxROI(int n, ROI r[]);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add gap pixels to the image (only for Eiger in 4 bit mode)
|
* add gap pixels to the image (only for Eiger in 4 bit mode)
|
||||||
* @param image pointer to image without gap pixels
|
* @param image pointer to image without gap pixels
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
class ServerInterface;
|
class ServerInterface;
|
||||||
|
|
||||||
#define SLS_SHMAPIVERSION 0x190726
|
#define SLS_SHMAPIVERSION 0x190726
|
||||||
#define SLS_SHMVERSION 0x190726
|
#define SLS_SHMVERSION 0x190813
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @short structure allocated in shared memory to store detector settings for
|
* @short structure allocated in shared memory to store detector settings for
|
||||||
@ -35,10 +35,6 @@ struct sharedSlsDetector {
|
|||||||
|
|
||||||
/** END OF FIXED PATTERN -----------------------------------------------*/
|
/** END OF FIXED PATTERN -----------------------------------------------*/
|
||||||
|
|
||||||
/** Detector offset in the X & Y direction in the multi detector structure
|
|
||||||
*/
|
|
||||||
int offset[2];
|
|
||||||
|
|
||||||
/** Number of detectors in multi list in x dir and y dir */
|
/** Number of detectors in multi list in x dir and y dir */
|
||||||
int multiSize[2];
|
int multiSize[2];
|
||||||
|
|
||||||
@ -75,11 +71,8 @@ struct sharedSlsDetector {
|
|||||||
/** size of the data that are transfered from the detector */
|
/** size of the data that are transfered from the detector */
|
||||||
int dataBytes;
|
int dataBytes;
|
||||||
|
|
||||||
/** number of rois defined */
|
/** roi */
|
||||||
int nROI;
|
slsDetectorDefs::ROI roi;
|
||||||
|
|
||||||
/** list of rois */
|
|
||||||
slsDetectorDefs::ROI roiLimits[MAX_ROIS];
|
|
||||||
|
|
||||||
/** adc enable mask */
|
/** adc enable mask */
|
||||||
uint32_t adcEnableMask;
|
uint32_t adcEnableMask;
|
||||||
@ -339,7 +332,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update total number of channels (chiptestboard or moench)
|
* Update total number of channels (chiptestboard or moench)
|
||||||
* depending on the number of samples, roi, readout flags(ctb)
|
* depending on the number of samples, adenablemask, readout flags(ctb)
|
||||||
*/
|
*/
|
||||||
void updateTotalNumberOfChannels();
|
void updateTotalNumberOfChannels();
|
||||||
|
|
||||||
@ -423,32 +416,6 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
int getReadNLines();
|
int getReadNLines();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Detector offset from shared memory in dimension d
|
|
||||||
* @param d dimension d
|
|
||||||
* @returns offset in dimension d
|
|
||||||
*/
|
|
||||||
int getDetectorOffset(dimension d) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Detector offset from shared memory in dimension d
|
|
||||||
* @returns offset
|
|
||||||
*/
|
|
||||||
slsDetectorDefs::coordinates getDetectorOffsets() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Detector offset in shared memory in dimension d
|
|
||||||
* @param d dimension d
|
|
||||||
* @param off offset for detector
|
|
||||||
*/
|
|
||||||
void setDetectorOffset(dimension d, int off);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Detector offset in shared memory
|
|
||||||
* @param value offset for detector
|
|
||||||
*/
|
|
||||||
void setDetectorOffsets(slsDetectorDefs::coordinates value);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Detector offset in shared memory in dimension d
|
* Set Detector offset in shared memory in dimension d
|
||||||
* @param detx number of detectors in X dir in multi list
|
* @param detx number of detectors in X dir in multi list
|
||||||
@ -1143,35 +1110,29 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
int setCounterBit(int cb = -1);
|
int setCounterBit(int cb = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear ROI (Gotthard)
|
||||||
|
*/
|
||||||
|
void clearROI();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ROI (Gotthard)
|
* Set ROI (Gotthard)
|
||||||
* At the moment only one set allowed
|
* Also calls configuremac
|
||||||
* @param n number of rois
|
* @param arg roi
|
||||||
* @param roiLimits array of roi
|
|
||||||
*/
|
*/
|
||||||
void setROI(int n = -1, ROI roiLimits[] = nullptr);
|
void setROI(slsDetectorDefs::ROI arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ROI from each detector and convert it to the multi detector scale
|
* Send ROI from shared memory to Receiver (Gotthard)
|
||||||
* (Gotthard)
|
|
||||||
* @param n number of rois
|
|
||||||
* @returns OK or FAIL
|
|
||||||
*/
|
*/
|
||||||
const slsDetectorDefs::ROI *getROI(int &n);
|
void sendROItoReceiver();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns number of rois
|
* Get ROI (Gotthard)
|
||||||
* @returns number of ROIs
|
* Update receiver if different from shm
|
||||||
|
* @returns roi
|
||||||
*/
|
*/
|
||||||
int getNRoi();
|
slsDetectorDefs::ROI getROI();
|
||||||
|
|
||||||
/**
|
|
||||||
* Send ROI to the detector after calculating
|
|
||||||
* from setROI
|
|
||||||
* @param n number of ROIs (-1 to get)
|
|
||||||
* @param roiLimits ROI
|
|
||||||
*/
|
|
||||||
void sendROI(int n = -1, ROI roiLimits[] = nullptr);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ADC Enable Mask (CTB, Moench)
|
* Set ADC Enable Mask (CTB, Moench)
|
||||||
|
@ -104,7 +104,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Returns the maximum number of channels of all detectors
|
* Returns the maximum number of channels of all detectors
|
||||||
* (provided by user in config file using detsizechan command)
|
* (provided by user in config file using detsizechan command)
|
||||||
* Offsets are calculated according to these dimensions
|
* number of channels in x and y are calculated according to these dimensions
|
||||||
* @param nx number of channels in horizontal
|
* @param nx number of channels in horizontal
|
||||||
* @param ny number of channels in vertical
|
* @param ny number of channels in vertical
|
||||||
* @returns the maximum number of channels of all detectors
|
* @returns the maximum number of channels of all detectors
|
||||||
@ -112,15 +112,13 @@ public:
|
|||||||
int getMaximumDetectorSize(int &nx, int &ny);
|
int getMaximumDetectorSize(int &nx, int &ny);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the size and offsets of detector/multi detector
|
* Returns the size of detector/multi detector
|
||||||
* @param x horizontal position origin in channel number
|
|
||||||
* @param y 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
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns the total number of channels of all sls detectors
|
* @returns the total number of channels of all sls detectors
|
||||||
*/
|
*/
|
||||||
int getDetectorSize(int &x, int &y, int &nx, int &ny, int detPos = -1);
|
int getDetectorSize(int &nx, int &ny, int detPos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets detector type
|
* Gets detector type
|
||||||
@ -496,22 +494,22 @@ public:
|
|||||||
int setFlowControl10G(int enable = -1, int detPos = -1);
|
int setFlowControl10G(int enable = -1, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ROI (Gotthard) (>= 1 roi, but max 1 roi per module)
|
* Set ROI (Gotthard)
|
||||||
* At the moment only one set allowed
|
* At the moment only one set allowed per module
|
||||||
* @param n number of rois
|
* Only allowed to set one ROI per module
|
||||||
* @param roiLimits array of roi
|
* @param arg roi
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos specific detector position
|
||||||
*/
|
*/
|
||||||
void setROI(int n=-1, slsDetectorDefs::ROI roiLimits[]=NULL, int detPos = -1);
|
void setROI(slsDetectorDefs::ROI arg, int detPos = -1);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
|
* Get ROI (Gotthard)
|
||||||
* >= 1 roi, but max 1 roi per module
|
* Only allowed to set one ROI per module
|
||||||
* @param n number of rois
|
* @param detPos specific detector position
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @returns roi
|
||||||
* @returns pointer to array of ROI structure
|
|
||||||
*/
|
*/
|
||||||
const slsDetectorDefs::ROI* getROI(int &n, int detPos = -1);
|
slsDetectorDefs::ROI getROI(int detPos = -1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,16 +110,6 @@ void Detector::setMaxNumberOfChannels(const defs::coordinates value) {
|
|||||||
pimpl->setMaxNumberOfChannels(value);
|
pimpl->setMaxNumberOfChannels(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<defs::coordinates> Detector::getDetectorOffsets(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&slsDetector::getDetectorOffsets, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setDetectorOffsets(defs::coordinates value, Positions pos) {
|
|
||||||
pimpl->Parallel(&slsDetector::setDetectorOffsets, pos, value);
|
|
||||||
// pimpl->Parallel<defs::coordinates>(&slsDetector::setDetectorOffset, pos,
|
|
||||||
// value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<bool> Detector::getQuad(Positions pos) const {
|
Result<bool> Detector::getQuad(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getQuad, pos);
|
return pimpl->Parallel(&slsDetector::getQuad, pos);
|
||||||
}
|
}
|
||||||
@ -1071,41 +1061,15 @@ void Detector::setCounterBit(bool value, Positions pos) {
|
|||||||
pimpl->Parallel(&slsDetector::setCounterBit, pos, value);
|
pimpl->Parallel(&slsDetector::setCounterBit, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::vector<defs::ROI>> Detector::getROI(Positions pos) const {
|
Result<defs::ROI> Detector::getROI(Positions pos) const {
|
||||||
//vector holding module_id for the modules that should be read
|
return pimpl->Parallel(&slsDetector::getROI, pos);
|
||||||
const std::vector<int> id_vec = [&]() {
|
|
||||||
if (pos.empty() || (pos.size() == 1 && pos[0] == -1)){
|
|
||||||
std::vector<int> tmp;
|
|
||||||
for(size_t i=0; i!= pimpl->size(); ++i)
|
|
||||||
tmp.push_back(i);
|
|
||||||
return tmp;
|
|
||||||
}else{
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
|
|
||||||
//values to return
|
|
||||||
Result<std::vector<defs::ROI>> res;
|
|
||||||
|
|
||||||
//for each detector id get the ROI
|
|
||||||
for (const auto& i :id_vec){
|
|
||||||
int n = 0;
|
|
||||||
auto ptr = pimpl->getROI(n, i);
|
|
||||||
// res.emplace_back(ptr, ptr+n);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setROI(std::vector<defs::ROI> value, Positions pos) {
|
void Detector::setROI(defs::ROI value, int moduleId) {
|
||||||
if (pos.empty() || (pos.size() == 1 && pos[0] == -1)) {
|
if (moduleId < 0 && size() > 1) {
|
||||||
pimpl->setROI(static_cast<int>(value.size()), value.data(), -1);
|
throw RuntimeError("Cannot set ROI for all modules simultaneously");
|
||||||
} else if (pos.size() > 1) {
|
|
||||||
throw RuntimeError("Cannot set roi to a subset of modules");
|
|
||||||
} else {
|
|
||||||
pimpl->Parallel(&slsDetector::setROI, pos,
|
|
||||||
static_cast<int>(value.size()), value.data());
|
|
||||||
}
|
}
|
||||||
|
pimpl->Parallel(&slsDetector::setROI, {moduleId}, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<uint32_t> Detector::getADCEnableMask(Positions pos) const {
|
Result<uint32_t> Detector::getADCEnableMask(Positions pos) const {
|
||||||
|
@ -283,8 +283,8 @@ void multiSlsDetector::initializeDetectorStructure() {
|
|||||||
multi_shm()->numberOfChannel[Y] = 0;
|
multi_shm()->numberOfChannel[Y] = 0;
|
||||||
multi_shm()->numberOfChannelInclGapPixels[X] = 0;
|
multi_shm()->numberOfChannelInclGapPixels[X] = 0;
|
||||||
multi_shm()->numberOfChannelInclGapPixels[Y] = 0;
|
multi_shm()->numberOfChannelInclGapPixels[Y] = 0;
|
||||||
multi_shm()->maxNumberOfChannelsPerDetector[X] = 0;
|
multi_shm()->maxNumberOfChannelsPerDetector[X] = -1;
|
||||||
multi_shm()->maxNumberOfChannelsPerDetector[Y] = 0;
|
multi_shm()->maxNumberOfChannelsPerDetector[Y] = -1;
|
||||||
multi_shm()->acquiringFlag = false;
|
multi_shm()->acquiringFlag = false;
|
||||||
multi_shm()->receiver_upstream = false;
|
multi_shm()->receiver_upstream = false;
|
||||||
}
|
}
|
||||||
@ -303,9 +303,6 @@ void multiSlsDetector::initializeMembers(bool verify) {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// depend on number of detectors
|
|
||||||
updateOffsets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::updateUserdetails() {
|
void multiSlsDetector::updateUserdetails() {
|
||||||
@ -333,197 +330,6 @@ bool multiSlsDetector::isAcquireReady() {
|
|||||||
return OK != 0u;
|
return OK != 0u;
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::decodeNChannel(int offsetX, int offsetY, int &channelX,
|
|
||||||
int &channelY) {
|
|
||||||
channelX = -1;
|
|
||||||
channelY = -1;
|
|
||||||
// loop over
|
|
||||||
for (size_t i = 0; i < detectors.size(); ++i) {
|
|
||||||
int x = detectors[i]->getDetectorOffset(X);
|
|
||||||
int y = detectors[i]->getDetectorOffset(Y);
|
|
||||||
// check x offset range
|
|
||||||
if ((offsetX >= x) &&
|
|
||||||
(offsetX <
|
|
||||||
(x + detectors[i]->getTotalNumberOfChannelsInclGapPixels(X)))) {
|
|
||||||
if (offsetY == -1) {
|
|
||||||
channelX = offsetX - x;
|
|
||||||
return i;
|
|
||||||
} else {
|
|
||||||
// check y offset range
|
|
||||||
if ((offsetY >= y) &&
|
|
||||||
(offsetY <
|
|
||||||
(y + detectors[i]->getTotalNumberOfChannelsInclGapPixels(
|
|
||||||
Y)))) {
|
|
||||||
channelX = offsetX - x;
|
|
||||||
channelY = offsetY - y;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void multiSlsDetector::updateOffsets() {
|
|
||||||
FILE_LOG(logDEBUG1) << "Updating Multi-Detector Offsets";
|
|
||||||
|
|
||||||
int offsetX = 0, offsetY = 0, numX = 0, numY = 0;
|
|
||||||
int maxChanX = multi_shm()->maxNumberOfChannelsPerDetector[X];
|
|
||||||
int maxChanY = multi_shm()->maxNumberOfChannelsPerDetector[Y];
|
|
||||||
int prevChanX = 0;
|
|
||||||
int prevChanY = 0;
|
|
||||||
bool firstTime = true;
|
|
||||||
|
|
||||||
multi_shm()->numberOfChannel[X] = 0;
|
|
||||||
multi_shm()->numberOfChannel[Y] = 0;
|
|
||||||
multi_shm()->numberOfDetector[X] = 0;
|
|
||||||
multi_shm()->numberOfDetector[Y] = 0;
|
|
||||||
|
|
||||||
// gap pixels
|
|
||||||
int offsetX_gp = 0, offsetY_gp = 0, numX_gp = 0, numY_gp = 0;
|
|
||||||
int prevChanX_gp = 0, prevChanY_gp = 0;
|
|
||||||
multi_shm()->numberOfChannelInclGapPixels[X] = 0;
|
|
||||||
multi_shm()->numberOfChannelInclGapPixels[Y] = 0;
|
|
||||||
|
|
||||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< "offsetX:" << offsetX << " prevChanX:" << prevChanX
|
|
||||||
<< " offsetY:" << offsetY << " prevChanY:" << prevChanY
|
|
||||||
<< " offsetX_gp:" << offsetX_gp << " prevChanX_gp:" << prevChanX_gp
|
|
||||||
<< " offsetY_gp:" << offsetY_gp << " prevChanY_gp:" << prevChanY_gp;
|
|
||||||
|
|
||||||
// incrementing in both direction
|
|
||||||
if (firstTime) {
|
|
||||||
// incrementing in both directions
|
|
||||||
firstTime = false;
|
|
||||||
if ((maxChanX > 0) &&
|
|
||||||
((offsetX + detectors[idet]->getTotalNumberOfChannels(X)) >
|
|
||||||
maxChanX)) {
|
|
||||||
FILE_LOG(logWARNING)
|
|
||||||
<< "\nDetector[" << idet
|
|
||||||
<< "] exceeds maximum channels "
|
|
||||||
"allowed for complete detector set in X dimension!";
|
|
||||||
}
|
|
||||||
if ((maxChanY > 0) &&
|
|
||||||
((offsetY + detectors[idet]->getTotalNumberOfChannels(Y)) >
|
|
||||||
maxChanY)) {
|
|
||||||
FILE_LOG(logERROR)
|
|
||||||
<< "\nDetector[" << idet
|
|
||||||
<< "] exceeds maximum channels "
|
|
||||||
"allowed for complete detector set in Y dimension!";
|
|
||||||
}
|
|
||||||
prevChanX = detectors[idet]->getTotalNumberOfChannels(X);
|
|
||||||
prevChanY = detectors[idet]->getTotalNumberOfChannels(Y);
|
|
||||||
prevChanX_gp =
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(X);
|
|
||||||
prevChanY_gp =
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
|
|
||||||
numX += detectors[idet]->getTotalNumberOfChannels(X);
|
|
||||||
numY += detectors[idet]->getTotalNumberOfChannels(Y);
|
|
||||||
numX_gp +=
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(X);
|
|
||||||
numY_gp +=
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
|
|
||||||
++multi_shm()->numberOfDetector[X];
|
|
||||||
++multi_shm()->numberOfDetector[Y];
|
|
||||||
FILE_LOG(logDEBUG1) << "incrementing in both direction";
|
|
||||||
}
|
|
||||||
|
|
||||||
// incrementing in y direction
|
|
||||||
else if ((maxChanY == -1) ||
|
|
||||||
((maxChanY > 0) && ((offsetY + prevChanY +
|
|
||||||
detectors[idet]->getTotalNumberOfChannels(
|
|
||||||
Y)) <= maxChanY))) {
|
|
||||||
offsetY += prevChanY;
|
|
||||||
offsetY_gp += prevChanY_gp;
|
|
||||||
prevChanY = detectors[idet]->getTotalNumberOfChannels(Y);
|
|
||||||
prevChanY_gp =
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
|
|
||||||
numY += detectors[idet]->getTotalNumberOfChannels(Y);
|
|
||||||
numY_gp +=
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
|
|
||||||
// increment in y again only in the first column (else you double
|
|
||||||
// increment)
|
|
||||||
if (multi_shm()->numberOfDetector[X] == 1)
|
|
||||||
++multi_shm()->numberOfDetector[Y];
|
|
||||||
FILE_LOG(logDEBUG1) << "incrementing in y direction";
|
|
||||||
}
|
|
||||||
|
|
||||||
// incrementing in x direction
|
|
||||||
else {
|
|
||||||
if ((maxChanX > 0) &&
|
|
||||||
((offsetX + prevChanX +
|
|
||||||
detectors[idet]->getTotalNumberOfChannels(X)) > maxChanX)) {
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< "\nDetector[" << idet
|
|
||||||
<< "] exceeds maximum channels "
|
|
||||||
"allowed for complete detector set in X dimension!";
|
|
||||||
}
|
|
||||||
offsetY = 0;
|
|
||||||
offsetY_gp = 0;
|
|
||||||
prevChanY = detectors[idet]->getTotalNumberOfChannels(Y);
|
|
||||||
prevChanY_gp =
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
|
|
||||||
numY = 0; // assuming symmetry with this statement.
|
|
||||||
// whats on 1st column should be on 2nd column
|
|
||||||
numY_gp = 0;
|
|
||||||
offsetX += prevChanX;
|
|
||||||
offsetX_gp += prevChanX_gp;
|
|
||||||
prevChanX = detectors[idet]->getTotalNumberOfChannels(X);
|
|
||||||
prevChanX_gp =
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(X);
|
|
||||||
numX += detectors[idet]->getTotalNumberOfChannels(X);
|
|
||||||
numX_gp +=
|
|
||||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(X);
|
|
||||||
++multi_shm()->numberOfDetector[X];
|
|
||||||
FILE_LOG(logDEBUG1) << "incrementing in x direction";
|
|
||||||
}
|
|
||||||
|
|
||||||
double bytesperchannel =
|
|
||||||
(double)detectors[idet]->getDataBytes() /
|
|
||||||
(double)(detectors[idet]->getTotalNumberOfChannels(X) *
|
|
||||||
detectors[idet]->getTotalNumberOfChannels(Y));
|
|
||||||
detectors[idet]->setDetectorOffset(
|
|
||||||
X, (bytesperchannel >= 1.0) ? offsetX_gp : offsetX);
|
|
||||||
detectors[idet]->setDetectorOffset(
|
|
||||||
Y, (bytesperchannel >= 1.0) ? offsetY_gp : offsetY);
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << "Detector[" << idet << "] has offsets ("
|
|
||||||
<< detectors[idet]->getDetectorOffset(X) << ", "
|
|
||||||
<< detectors[idet]->getDetectorOffset(Y) << ")";
|
|
||||||
// offsetY has been reset sometimes and offsetX the first time,
|
|
||||||
// but remember the highest values
|
|
||||||
if (numX > multi_shm()->numberOfChannel[X]) {
|
|
||||||
multi_shm()->numberOfChannel[X] = numX;
|
|
||||||
}
|
|
||||||
if (numY > multi_shm()->numberOfChannel[Y]) {
|
|
||||||
multi_shm()->numberOfChannel[Y] = numY;
|
|
||||||
}
|
|
||||||
if (numX_gp > multi_shm()->numberOfChannelInclGapPixels[X]) {
|
|
||||||
multi_shm()->numberOfChannelInclGapPixels[X] = numX_gp;
|
|
||||||
}
|
|
||||||
if (numY_gp > multi_shm()->numberOfChannelInclGapPixels[Y]) {
|
|
||||||
multi_shm()->numberOfChannelInclGapPixels[Y] = numY_gp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< "\n\tNumber of Channels in X direction:"
|
|
||||||
<< multi_shm()->numberOfChannel[X]
|
|
||||||
<< "\n\tNumber of Channels in Y direction:"
|
|
||||||
<< multi_shm()->numberOfChannel[Y]
|
|
||||||
<< "\n\tNumber of Channels in X direction with Gap Pixels:"
|
|
||||||
<< multi_shm()->numberOfChannelInclGapPixels[X]
|
|
||||||
<< "\n\tNumber of Channels in Y direction with Gap Pixels:"
|
|
||||||
<< multi_shm()->numberOfChannelInclGapPixels[Y];
|
|
||||||
|
|
||||||
multi_shm()->numberOfChannels =
|
|
||||||
multi_shm()->numberOfChannel[0] * multi_shm()->numberOfChannel[1];
|
|
||||||
|
|
||||||
for (auto &d : detectors) {
|
|
||||||
d->updateMultiSize(multi_shm()->numberOfDetector[0],
|
|
||||||
multi_shm()->numberOfDetector[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string multiSlsDetector::exec(const char *cmd) {
|
std::string multiSlsDetector::exec(const char *cmd) {
|
||||||
int bufsize = 128;
|
int bufsize = 128;
|
||||||
@ -560,8 +366,6 @@ void multiSlsDetector::setHostname(const std::vector<std::string> &name) {
|
|||||||
for (const auto &hostname : name) {
|
for (const auto &hostname : name) {
|
||||||
addSlsDetector(hostname);
|
addSlsDetector(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateOffsets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::setHostname(const char *name, int detPos) {
|
void multiSlsDetector::setHostname(const char *name, int detPos) {
|
||||||
@ -598,8 +402,7 @@ void multiSlsDetector::addMultipleDetectors(const char *name) {
|
|||||||
for (const auto &hostname : sls::split(name, '+')) {
|
for (const auto &hostname : sls::split(name, '+')) {
|
||||||
addSlsDetector(hostname);
|
addSlsDetector(hostname);
|
||||||
}
|
}
|
||||||
|
updateDetectorSize();
|
||||||
updateOffsets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
||||||
@ -623,11 +426,63 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
|||||||
sls::make_unique<slsDetector>(type, multiId, pos, false));
|
sls::make_unique<slsDetector>(type, multiId, pos, false));
|
||||||
multi_shm()->numberOfDetectors = detectors.size();
|
multi_shm()->numberOfDetectors = detectors.size();
|
||||||
multi_shm()->numberOfChannels += detectors[pos]->getTotalNumberOfChannels();
|
multi_shm()->numberOfChannels += detectors[pos]->getTotalNumberOfChannels();
|
||||||
|
|
||||||
detectors[pos]->setHostname(hostname);
|
detectors[pos]->setHostname(hostname);
|
||||||
multi_shm()->multiDetectorType = getDetectorTypeAsEnum(-1);// -1 needed here
|
multi_shm()->multiDetectorType = getDetectorTypeAsEnum(-1);// -1 needed here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void multiSlsDetector::updateDetectorSize() {
|
||||||
|
FILE_LOG(logDEBUG) << "Updating Multi-Detector Size: " << size();
|
||||||
|
|
||||||
|
int my = detectors[0]->getTotalNumberOfChannels(Y);
|
||||||
|
int mx = detectors[0]->getTotalNumberOfChannels(X);
|
||||||
|
int mgy = detectors[0]->getTotalNumberOfChannelsInclGapPixels(Y);
|
||||||
|
int mgx = detectors[0]->getTotalNumberOfChannelsInclGapPixels(X);
|
||||||
|
if (mgy == 0) {
|
||||||
|
mgy = my;
|
||||||
|
mgx = mx;
|
||||||
|
}
|
||||||
|
|
||||||
|
int maxy = multi_shm()->maxNumberOfChannelsPerDetector[Y];
|
||||||
|
if (maxy == -1) {
|
||||||
|
maxy = my * size();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ndety = maxy / my;
|
||||||
|
int ndetx = size() / ndety;
|
||||||
|
if ((maxy % my) > 0) {
|
||||||
|
++ndetx;
|
||||||
|
}
|
||||||
|
|
||||||
|
multi_shm()->numberOfDetector[X] = ndetx;
|
||||||
|
multi_shm()->numberOfDetector[Y] = ndety;
|
||||||
|
multi_shm()->numberOfChannel[X] = mx * ndetx;
|
||||||
|
multi_shm()->numberOfChannel[Y] = my * ndety;
|
||||||
|
multi_shm()->numberOfChannelInclGapPixels[X] = mgx * ndetx;
|
||||||
|
multi_shm()->numberOfChannelInclGapPixels[Y] = mgy * ndety;
|
||||||
|
|
||||||
|
FILE_LOG(logDEBUG)
|
||||||
|
<< "\n\tNumber of Detectors in X direction:"
|
||||||
|
<< multi_shm()->numberOfDetector[X]
|
||||||
|
<< "\n\tNumber of Detectors in Y direction:"
|
||||||
|
<< multi_shm()->numberOfDetector[Y]
|
||||||
|
<< "\n\tNumber of Channels in X direction:"
|
||||||
|
<< multi_shm()->numberOfChannel[X]
|
||||||
|
<< "\n\tNumber of Channels in Y direction:"
|
||||||
|
<< multi_shm()->numberOfChannel[Y]
|
||||||
|
<< "\n\tNumber of Channels in X direction with Gap Pixels:"
|
||||||
|
<< multi_shm()->numberOfChannelInclGapPixels[X]
|
||||||
|
<< "\n\tNumber of Channels in Y direction with Gap Pixels:"
|
||||||
|
<< multi_shm()->numberOfChannelInclGapPixels[Y];
|
||||||
|
|
||||||
|
multi_shm()->numberOfChannels =
|
||||||
|
multi_shm()->numberOfChannel[0] * multi_shm()->numberOfChannel[1];
|
||||||
|
|
||||||
|
for (auto &d : detectors) {
|
||||||
|
d->updateMultiSize(multi_shm()->numberOfDetector[0],
|
||||||
|
multi_shm()->numberOfDetector[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const {
|
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const {
|
||||||
return multi_shm()->multiDetectorType;
|
return multi_shm()->multiDetectorType;
|
||||||
}
|
}
|
||||||
@ -732,14 +587,6 @@ void multiSlsDetector::setMaxNumberOfChannels(const slsDetectorDefs::coordinates
|
|||||||
multi_shm()->maxNumberOfChannelsPerDetector[Y] = c.y;
|
multi_shm()->maxNumberOfChannelsPerDetector[Y] = c.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::getDetectorOffset(dimension d, int detPos) {
|
|
||||||
return detectors[detPos]->getDetectorOffset(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
void multiSlsDetector::setDetectorOffset(dimension d, int off, int detPos) {
|
|
||||||
detectors[detPos]->setDetectorOffset(d, off);
|
|
||||||
}
|
|
||||||
|
|
||||||
int multiSlsDetector::getQuad(int detPos) {
|
int multiSlsDetector::getQuad(int detPos) {
|
||||||
int retval = detectors[0]->getQuad();
|
int retval = detectors[0]->getQuad();
|
||||||
if (retval && size() > 1) {
|
if (retval && size() > 1) {
|
||||||
@ -1272,8 +1119,6 @@ int multiSlsDetector::setDynamicRange(int dr, int detPos) {
|
|||||||
// change in dr
|
// change in dr
|
||||||
if (dr != -1 && dr != prevValue) {
|
if (dr != -1 && dr != prevValue) {
|
||||||
|
|
||||||
updateOffsets();
|
|
||||||
|
|
||||||
// update speed, check ratecorrection
|
// update speed, check ratecorrection
|
||||||
if (getDetectorTypeAsEnum() == EIGER) {
|
if (getDetectorTypeAsEnum() == EIGER) {
|
||||||
|
|
||||||
@ -2172,318 +2017,40 @@ int multiSlsDetector::setCounterBit(int i, int detPos) {
|
|||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::verifyMinMaxROI(int n, ROI r[]) {
|
void multiSlsDetector::clearROI(int detPos) {
|
||||||
int temp;
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
if ((r[i].xmax) < (r[i].xmin)) {
|
|
||||||
temp = r[i].xmax;
|
|
||||||
r[i].xmax = r[i].xmin;
|
|
||||||
r[i].xmin = temp;
|
|
||||||
}
|
|
||||||
if ((r[i].ymax) < (r[i].ymin)) {
|
|
||||||
temp = r[i].ymax;
|
|
||||||
r[i].ymax = r[i].ymin;
|
|
||||||
r[i].ymin = temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
detectors[detPos]->setROI(n, roiLimits);
|
detectors[detPos]->clearROI();
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
int xmin = 0, xmax = 0, ymin = 0, ymax = 0, channelX = 0, channelY = 0,
|
parallelCall(&slsDetector::clearROI);
|
||||||
idet = 0, lastChannelX = 0, lastChannelY = 0, index = 0, offsetX = 0,
|
|
||||||
offsetY = 0;
|
|
||||||
|
|
||||||
bool invalidroi = false;
|
|
||||||
int ndet = detectors.size();
|
|
||||||
ROI allroi[ndet][n];
|
|
||||||
int nroi[ndet];
|
|
||||||
for (int i = 0; i < ndet; ++i) {
|
|
||||||
nroi[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((n < 0) || (roiLimits == nullptr)) {
|
|
||||||
throw RuntimeError("Cannot set ROI due to Invalid ROI");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensures min < max
|
|
||||||
verifyMinMaxROI(n, roiLimits);
|
|
||||||
FILE_LOG(logDEBUG1) << "Setting ROI for " << n << "rois:";
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< i << ":" << roiLimits[i].xmin << "\t" << roiLimits[i].xmax
|
|
||||||
<< "\t" << roiLimits[i].ymin << "\t" << roiLimits[i].ymax;
|
|
||||||
}
|
|
||||||
// for each roi
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
xmin = roiLimits[i].xmin;
|
|
||||||
xmax = roiLimits[i].xmax;
|
|
||||||
ymin = roiLimits[i].ymin;
|
|
||||||
ymax = roiLimits[i].ymax;
|
|
||||||
|
|
||||||
if (size() > 1) {
|
|
||||||
// check roi max values
|
|
||||||
idet = decodeNChannel(xmax, ymax, channelX, channelY);
|
|
||||||
FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl
|
|
||||||
<< "det:" << idet << "\t" << xmax << "\t"
|
|
||||||
<< ymax << "\t" << channelX << "\t" << channelY;
|
|
||||||
if (idet == -1) {
|
|
||||||
FILE_LOG(logERROR) << "invalid roi";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// split in x dir
|
|
||||||
while (xmin <= xmax) {
|
|
||||||
invalidroi = false;
|
|
||||||
ymin = roiLimits[i].ymin;
|
|
||||||
// split in y dir
|
|
||||||
while (ymin <= ymax) {
|
|
||||||
// get offset for each detector
|
|
||||||
idet = decodeNChannel(xmin, ymin, channelX, channelY);
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< "Decoded Channel min vals: " << std::endl
|
|
||||||
<< "det:" << idet << "\t" << xmin << "\t" << ymin
|
|
||||||
<< "\t" << channelX << "\t" << channelY;
|
|
||||||
if (idet < 0 || idet >= (int)detectors.size()) {
|
|
||||||
FILE_LOG(logDEBUG1) << "invalid roi";
|
|
||||||
invalidroi = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// get last channel for each det in x and y dir
|
|
||||||
lastChannelX =
|
|
||||||
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
|
||||||
X)) -
|
|
||||||
1;
|
|
||||||
lastChannelY =
|
|
||||||
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
|
||||||
Y)) -
|
|
||||||
1;
|
|
||||||
|
|
||||||
offsetX = detectors[idet]->getDetectorOffset(X);
|
|
||||||
offsetY = detectors[idet]->getDetectorOffset(Y);
|
|
||||||
// at the end in x dir
|
|
||||||
if ((offsetX + lastChannelX) >= xmax) {
|
|
||||||
lastChannelX = xmax - offsetX;
|
|
||||||
}
|
|
||||||
// at the end in y dir
|
|
||||||
if ((offsetY + lastChannelY) >= ymax) {
|
|
||||||
lastChannelY = ymax - offsetY;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< "lastChannelX:" << lastChannelX << "\t"
|
|
||||||
<< "lastChannelY:" << lastChannelY;
|
|
||||||
|
|
||||||
// creating the list of roi for corresponding detector
|
|
||||||
index = nroi[idet];
|
|
||||||
allroi[idet][index].xmin = channelX;
|
|
||||||
allroi[idet][index].xmax = lastChannelX;
|
|
||||||
allroi[idet][index].ymin = channelY;
|
|
||||||
allroi[idet][index].ymax = lastChannelY;
|
|
||||||
nroi[idet] = nroi[idet] + 1;
|
|
||||||
|
|
||||||
ymin = lastChannelY + offsetY + 1;
|
|
||||||
if ((lastChannelY + offsetY) == ymax) {
|
|
||||||
ymin = ymax + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< "nroi[idet]:" << nroi[idet] << "\tymin:" << ymin;
|
|
||||||
}
|
|
||||||
if (invalidroi) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
xmin = lastChannelX + offsetX + 1;
|
|
||||||
if ((lastChannelX + offsetX) == xmax) {
|
|
||||||
xmin = xmax + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { // FIXME: check if xmax is greater? or reduce logic above?
|
|
||||||
idet = 0;
|
|
||||||
nroi[idet] = n;
|
|
||||||
index = 0;
|
|
||||||
allroi[idet][index].xmin = xmin;
|
|
||||||
allroi[idet][index].xmax = xmax;
|
|
||||||
allroi[idet][index].ymin = ymin;
|
|
||||||
allroi[idet][index].ymax = ymax;
|
|
||||||
// nroi[idet] = nroi[idet] + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << "Setting ROI :";
|
|
||||||
for (size_t i = 0; i < detectors.size(); ++i) {
|
|
||||||
FILE_LOG(logDEBUG1) << "detector " << i;
|
|
||||||
for (int j = 0; j < nroi[i]; ++j) {
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< allroi[i][j].xmin << "\t" << allroi[i][j].xmax << "\t"
|
|
||||||
<< allroi[i][j].ymin << "\t" << allroi[i][j].ymax;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// settings the rois for each detector
|
|
||||||
for (size_t i = 0; i != detectors.size(); ++i) {
|
|
||||||
detectors[i]->setROI(nroi[i], allroi[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
void multiSlsDetector::setROI(slsDetectorDefs::ROI arg, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->getROI(n);
|
detectors[detPos]->setROI(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
n = 0;
|
if (detPos < 0 && size() > 1) {
|
||||||
int num = 0;
|
throw RuntimeError("Cannot set ROI for all modules simultaneously");
|
||||||
int ndet = detectors.size();
|
}
|
||||||
int maxroi = ndet * MAX_ROIS;
|
detectors[0]->setROI(arg);
|
||||||
ROI temproi;
|
}
|
||||||
ROI roiLimits[maxroi];
|
|
||||||
ROI *retval = new ROI[maxroi];
|
|
||||||
const ROI *temp = nullptr;
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
// get each detector's roi array
|
slsDetectorDefs::ROI multiSlsDetector::getROI(int detPos) const {
|
||||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
// single
|
||||||
temp = detectors[idet]->getROI(index);
|
if (detPos >= 0) {
|
||||||
if (temp != nullptr) {
|
return detectors[detPos]->getROI();
|
||||||
if (index != 0) {
|
|
||||||
FILE_LOG(logINFO) << "detector " << idet << ":";
|
|
||||||
}
|
|
||||||
for (int j = 0; j < index; ++j) {
|
|
||||||
FILE_LOG(logINFO)
|
|
||||||
<< temp[j].xmin << "\t" << temp[j].xmax << "\t"
|
|
||||||
<< temp[j].ymin << "\t" << temp[j].ymax;
|
|
||||||
int x = detectors[idet]->getDetectorOffset(X);
|
|
||||||
int y = detectors[idet]->getDetectorOffset(Y);
|
|
||||||
roiLimits[n].xmin = temp[j].xmin + x;
|
|
||||||
roiLimits[n].xmax = temp[j].xmax + x;
|
|
||||||
roiLimits[n].ymin = temp[j].ymin + y;
|
|
||||||
roiLimits[n].ymax = temp[j].ymin + y;
|
|
||||||
++n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// empty roi
|
// multi
|
||||||
if (n == 0) {
|
if (detPos < 0 && size() > 1) {
|
||||||
return nullptr;
|
throw RuntimeError("Cannot get ROI for all modules simultaneously");
|
||||||
}
|
}
|
||||||
|
return detectors[0]->getROI();
|
||||||
FILE_LOG(logDEBUG1) << "ROI :" << std::endl;
|
|
||||||
for (int j = 0; j < n; ++j) {
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< roiLimits[j].xmin << "\t" << roiLimits[j].xmax << "\t"
|
|
||||||
<< roiLimits[j].ymin << "\t" << roiLimits[j].ymax;
|
|
||||||
}
|
|
||||||
|
|
||||||
// combine all the adjacent rois in x direction
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
// since the ones combined are replaced by -1
|
|
||||||
if ((roiLimits[i].xmin) == -1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int j = i + 1; j < n; ++j) {
|
|
||||||
// since the ones combined are replaced by -1
|
|
||||||
if ((roiLimits[j].xmin) == -1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// if y values are same
|
|
||||||
if (((roiLimits[i].ymin) == (roiLimits[j].ymin)) &&
|
|
||||||
((roiLimits[i].ymax) == (roiLimits[j].ymax))) {
|
|
||||||
// if adjacent, increase [i] range and replace all [j] with -1
|
|
||||||
if ((roiLimits[i].xmax) + 1 == roiLimits[j].xmin) {
|
|
||||||
roiLimits[i].xmax = roiLimits[j].xmax;
|
|
||||||
roiLimits[j].xmin = -1;
|
|
||||||
roiLimits[j].xmax = -1;
|
|
||||||
roiLimits[j].ymin = -1;
|
|
||||||
roiLimits[j].ymax = -1;
|
|
||||||
}
|
|
||||||
// if adjacent, increase [i] range and replace all [j] with -1
|
|
||||||
else if ((roiLimits[i].xmin) - 1 == roiLimits[j].xmax) {
|
|
||||||
roiLimits[i].xmin = roiLimits[j].xmin;
|
|
||||||
roiLimits[j].xmin = -1;
|
|
||||||
roiLimits[j].xmax = -1;
|
|
||||||
roiLimits[j].ymin = -1;
|
|
||||||
roiLimits[j].ymax = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << "Combined along x axis Getting ROI :\ndetector "
|
|
||||||
<< n;
|
|
||||||
for (int j = 0; j < n; ++j) {
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< roiLimits[j].xmin << "\t" << roiLimits[j].xmax << "\t"
|
|
||||||
<< roiLimits[j].ymin << "\t" << roiLimits[j].ymax;
|
|
||||||
}
|
|
||||||
|
|
||||||
// combine all the adjacent rois in y direction
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
// since the ones combined are replaced by -1
|
|
||||||
if ((roiLimits[i].ymin) == -1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int j = i + 1; j < n; ++j) {
|
|
||||||
// since the ones combined are replaced by -1
|
|
||||||
if ((roiLimits[j].ymin) == -1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// if x values are same
|
|
||||||
if (((roiLimits[i].xmin) == (roiLimits[j].xmin)) &&
|
|
||||||
((roiLimits[i].xmax) == (roiLimits[j].xmax))) {
|
|
||||||
// if adjacent, increase [i] range and replace all [j] with -1
|
|
||||||
if ((roiLimits[i].ymax) + 1 == roiLimits[j].ymin) {
|
|
||||||
roiLimits[i].ymax = roiLimits[j].ymax;
|
|
||||||
roiLimits[j].xmin = -1;
|
|
||||||
roiLimits[j].xmax = -1;
|
|
||||||
roiLimits[j].ymin = -1;
|
|
||||||
roiLimits[j].ymax = -1;
|
|
||||||
}
|
|
||||||
// if adjacent, increase [i] range and replace all [j] with -1
|
|
||||||
else if ((roiLimits[i].ymin) - 1 == roiLimits[j].ymax) {
|
|
||||||
roiLimits[i].ymin = roiLimits[j].ymin;
|
|
||||||
roiLimits[j].xmin = -1;
|
|
||||||
roiLimits[j].xmax = -1;
|
|
||||||
roiLimits[j].ymin = -1;
|
|
||||||
roiLimits[j].ymax = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get rid of -1s
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
if ((roiLimits[i].xmin) != -1) {
|
|
||||||
retval[num] = roiLimits[i];
|
|
||||||
++num;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// sort final roi
|
|
||||||
for (int i = 0; i < num; ++i) {
|
|
||||||
for (int j = i + 1; j < num; ++j) {
|
|
||||||
if (retval[j].xmin < retval[i].xmin) {
|
|
||||||
temproi = retval[i];
|
|
||||||
retval[i] = retval[j];
|
|
||||||
retval[j] = temproi;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
n = num;
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << "\nxmin\txmax\tymin\tymax";
|
|
||||||
for (int i = 0; i < n; ++i) {
|
|
||||||
FILE_LOG(logDEBUG1) << retval[i].xmin << "\t" << retval[i].xmax << "\t"
|
|
||||||
<< retval[i].ymin << "\t" << retval[i].ymax;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::setADCEnableMask(uint32_t mask, int detPos) {
|
void multiSlsDetector::setADCEnableMask(uint32_t mask, int detPos) {
|
||||||
@ -2688,15 +2255,16 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
|
|||||||
int ret = sls::minusOneIfDifferent(r);
|
int ret = sls::minusOneIfDifferent(r);
|
||||||
|
|
||||||
if (val != -1) {
|
if (val != -1) {
|
||||||
updateOffsets();
|
multi_shm()->numberOfChannelInclGapPixels[X] = sls::sum(parallelCall(&slsDetector::getTotalNumberOfChannelsInclGapPixels, X));
|
||||||
|
multi_shm()->numberOfChannelInclGapPixels[Y] = sls::sum(parallelCall(&slsDetector::getTotalNumberOfChannelsInclGapPixels, Y));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos){
|
void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos){
|
||||||
Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable));
|
Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable));
|
||||||
|
multi_shm()->numberOfChannelInclGapPixels[X] = sls::sum(parallelCall(&slsDetector::getTotalNumberOfChannelsInclGapPixels, X));
|
||||||
updateOffsets();
|
multi_shm()->numberOfChannelInclGapPixels[Y] = sls::sum(parallelCall(&slsDetector::getTotalNumberOfChannelsInclGapPixels, Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::setTrimEn(std::vector<int> energies, int detPos) {
|
int multiSlsDetector::setTrimEn(std::vector<int> energies, int detPos) {
|
||||||
|
@ -308,15 +308,13 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
|||||||
shm()->controlPort = DEFAULT_PORTNO;
|
shm()->controlPort = DEFAULT_PORTNO;
|
||||||
sls::strcpy_safe(shm()->hostname, DEFAULT_HOSTNAME);
|
sls::strcpy_safe(shm()->hostname, DEFAULT_HOSTNAME);
|
||||||
shm()->myDetectorType = type;
|
shm()->myDetectorType = type;
|
||||||
shm()->offset[X] = 0;
|
|
||||||
shm()->offset[Y] = 0;
|
|
||||||
shm()->multiSize[X] = 0;
|
shm()->multiSize[X] = 0;
|
||||||
shm()->multiSize[Y] = 0;
|
shm()->multiSize[Y] = 0;
|
||||||
|
shm()->controlPort = DEFAULT_PORTNO;
|
||||||
shm()->stopPort = DEFAULT_PORTNO + 1;
|
shm()->stopPort = DEFAULT_PORTNO + 1;
|
||||||
sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
|
sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
|
||||||
shm()->nROI = 0;
|
shm()->roi.xmin = -1;
|
||||||
memset(shm()->roiLimits, 0, MAX_ROIS * sizeof(ROI));
|
shm()->roi.xmax = -1;
|
||||||
shm()->adcEnableMask = BIT32_MASK;
|
shm()->adcEnableMask = BIT32_MASK;
|
||||||
shm()->roFlags = NORMAL_READOUT;
|
shm()->roFlags = NORMAL_READOUT;
|
||||||
shm()->currentSettings = UNINITIALIZED;
|
shm()->currentSettings = UNINITIALIZED;
|
||||||
@ -688,28 +686,6 @@ int slsDetector::getReadNLines() {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetector::getDetectorOffset(dimension d) const {
|
|
||||||
return shm()->offset[d];
|
|
||||||
}
|
|
||||||
|
|
||||||
slsDetectorDefs::coordinates slsDetector::getDetectorOffsets() const {
|
|
||||||
slsDetectorDefs::coordinates coord;
|
|
||||||
coord.x = shm()->offset[X];
|
|
||||||
coord.y = shm()->offset[Y];
|
|
||||||
return coord;
|
|
||||||
}
|
|
||||||
|
|
||||||
void slsDetector::setDetectorOffset(dimension d, int off) {
|
|
||||||
if (off >= 0) {
|
|
||||||
shm()->offset[d] = off;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void slsDetector::setDetectorOffsets(slsDetectorDefs::coordinates value) {
|
|
||||||
shm()->offset[X] = value.x;
|
|
||||||
shm()->offset[Y] = value.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
void slsDetector::updateMultiSize(int detx, int dety) {
|
void slsDetector::updateMultiSize(int detx, int dety) {
|
||||||
shm()->multiSize[0] = detx;
|
shm()->multiSize[0] = detx;
|
||||||
shm()->multiSize[1] = dety;
|
shm()->multiSize[1] = dety;
|
||||||
@ -878,17 +854,9 @@ void slsDetector::updateCachedDetectorVariables() {
|
|||||||
// roi
|
// roi
|
||||||
if (shm()->myDetectorType == GOTTHARD) {
|
if (shm()->myDetectorType == GOTTHARD) {
|
||||||
n += client.Receive(&i32, sizeof(i32));
|
n += client.Receive(&i32, sizeof(i32));
|
||||||
shm()->nROI = i32;
|
shm()->roi.xmin = i32;
|
||||||
for (int i = 0; i < shm()->nROI; ++i) {
|
|
||||||
n += client.Receive(&i32, sizeof(i32));
|
n += client.Receive(&i32, sizeof(i32));
|
||||||
shm()->roiLimits[i].xmin = i32;
|
shm()->roi.xmax = i32;
|
||||||
n += client.Receive(&i32, sizeof(i32));
|
|
||||||
shm()->roiLimits[i].xmax = i32;
|
|
||||||
n += client.Receive(&i32, sizeof(i32));
|
|
||||||
shm()->roiLimits[i].ymin = i32;
|
|
||||||
n += client.Receive(&i32, sizeof(i32));
|
|
||||||
shm()->roiLimits[i].xmax = i32;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shm()->myDetectorType == CHIPTESTBOARD ||
|
if (shm()->myDetectorType == CHIPTESTBOARD ||
|
||||||
@ -1849,7 +1817,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
sendROI(-1, nullptr);
|
sendROItoReceiver();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2344,44 +2312,27 @@ int slsDetector::setCounterBit(int cb) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void slsDetector::setROI(int n, ROI roiLimits[]) {
|
void slsDetector::clearROI() {
|
||||||
std::sort(roiLimits, roiLimits + n,
|
FILE_LOG(logDEBUG1) << "Clearing ROI";
|
||||||
[](ROI a, ROI b) { return a.xmin < b.xmin; });
|
slsDetectorDefs::ROI arg;
|
||||||
|
arg.xmin = -1;
|
||||||
sendROI(n, roiLimits);
|
arg.xmax = -1;
|
||||||
|
setROI(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const slsDetectorDefs::ROI *slsDetector::getROI(int &n) {
|
void slsDetector::setROI(slsDetectorDefs::ROI arg) {
|
||||||
sendROI(-1, nullptr);
|
|
||||||
n = shm()->nROI;
|
|
||||||
return shm()->roiLimits;
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetector::getNRoi() { return shm()->nROI; }
|
|
||||||
|
|
||||||
void slsDetector::sendROI(int n, ROI roiLimits[]) {
|
|
||||||
int fnum = F_SET_ROI;
|
int fnum = F_SET_ROI;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
int narg = n;
|
if (arg.xmin < 0 || arg.xmax >= getTotalNumberOfChannels()) {
|
||||||
// send roiLimits if given, else from shm
|
arg.xmin = -1;
|
||||||
ROI *arg = (roiLimits != nullptr) ? roiLimits : shm()->roiLimits;
|
arg.xmax = -1;
|
||||||
int nretval = 0;
|
}
|
||||||
ROI retval[MAX_ROIS];
|
FILE_LOG(logDEBUG) << "Sending ROI to detector [" << arg.xmin << ", " << arg.xmax << "]";
|
||||||
FILE_LOG(logDEBUG1) << "Sending ROI to detector" << narg;
|
|
||||||
|
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
client.Send(&fnum, sizeof(fnum));
|
client.Send(&fnum, sizeof(fnum));
|
||||||
client.Send(&narg, sizeof(narg));
|
client.Send(&arg.xmin, sizeof(int));
|
||||||
if (narg != -1) {
|
client.Send(&arg.xmax, sizeof(int));
|
||||||
for (int i = 0; i < narg; ++i) {
|
|
||||||
client.Send(&arg[i].xmin, sizeof(int));
|
|
||||||
client.Send(&arg[i].xmax, sizeof(int));
|
|
||||||
client.Send(&arg[i].ymin, sizeof(int));
|
|
||||||
client.Send(&arg[i].ymax, sizeof(int));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
client.Receive(&ret, sizeof(ret));
|
client.Receive(&ret, sizeof(ret));
|
||||||
|
|
||||||
// handle ret
|
// handle ret
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
char mess[MAX_STR_LENGTH]{};
|
char mess[MAX_STR_LENGTH]{};
|
||||||
@ -2389,65 +2340,63 @@ void slsDetector::sendROI(int n, ROI roiLimits[]) {
|
|||||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
throw RuntimeError("Detector " + std::to_string(detId) +
|
||||||
" returned error: " + std::string(mess));
|
" returned error: " + std::string(mess));
|
||||||
} else {
|
} else {
|
||||||
client.Receive(&nretval, sizeof(nretval));
|
memcpy(&shm()->roi, &arg, sizeof(ROI));
|
||||||
int nrec = 0;
|
|
||||||
for (int i = 0; i < nretval; ++i) {
|
|
||||||
nrec += client.Receive(&retval[i].xmin, sizeof(int));
|
|
||||||
nrec += client.Receive(&retval[i].xmax, sizeof(int));
|
|
||||||
nrec += client.Receive(&retval[i].ymin, sizeof(int));
|
|
||||||
nrec += client.Receive(&retval[i].ymax, sizeof(int));
|
|
||||||
}
|
|
||||||
shm()->nROI = nretval;
|
|
||||||
FILE_LOG(logDEBUG1) << "nRoi: " << nretval;
|
|
||||||
for (int i = 0; i < nretval; ++i) {
|
|
||||||
shm()->roiLimits[i] = retval[i];
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< "ROI [" << i << "] (" << shm()->roiLimits[i].xmin << ","
|
|
||||||
<< shm()->roiLimits[i].xmax << "," << shm()->roiLimits[i].ymin
|
|
||||||
<< "," << shm()->roiLimits[i].ymax << ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ret == FORCE_UPDATE) {
|
if (ret == FORCE_UPDATE) {
|
||||||
updateCachedDetectorVariables();
|
updateCachedDetectorVariables();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// old firmware requires configuremac after setting roi
|
// old firmware requires configuremac after setting roi
|
||||||
if (shm()->myDetectorType == GOTTHARD && n != -1) {
|
if (shm()->myDetectorType == GOTTHARD) {
|
||||||
configureMAC();
|
configureMAC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendROItoReceiver();
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsDetector::sendROItoReceiver() {
|
||||||
// update roi in receiver
|
// update roi in receiver
|
||||||
if (shm()->useReceiverFlag) {
|
if (shm()->useReceiverFlag) {
|
||||||
fnum = F_RECEIVER_SET_ROI;
|
FILE_LOG(logDEBUG1) << "Sending ROI to receiver";
|
||||||
ret = FAIL;
|
sendToReceiver(F_RECEIVER_SET_ROI, shm()->roi, nullptr);
|
||||||
narg = shm()->nROI;
|
|
||||||
arg = shm()->roiLimits;
|
|
||||||
FILE_LOG(logDEBUG1) << "Sending ROI to receiver: " << shm()->nROI;
|
|
||||||
|
|
||||||
auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
|
||||||
receiver.Send(&fnum, sizeof(fnum));
|
|
||||||
receiver.Send(&narg, sizeof(narg));
|
|
||||||
if (narg != -1) {
|
|
||||||
for (int i = 0; i < narg; ++i) {
|
|
||||||
receiver.Send(&arg[i].xmin, sizeof(int));
|
|
||||||
receiver.Send(&arg[i].xmax, sizeof(int));
|
|
||||||
receiver.Send(&arg[i].ymin, sizeof(int));
|
|
||||||
receiver.Send(&arg[i].ymax, sizeof(int));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
receiver.Receive(&ret, sizeof(ret));
|
|
||||||
|
|
||||||
if (ret == FAIL) {
|
|
||||||
char mess[MAX_STR_LENGTH]{};
|
|
||||||
receiver.Receive(mess, MAX_STR_LENGTH);
|
|
||||||
throw ReceiverError("Receiver " + std::to_string(detId) +
|
|
||||||
" returned error: " + std::string(mess));
|
|
||||||
}
|
|
||||||
if (ret == FORCE_UPDATE) {
|
|
||||||
updateCachedReceiverVariables();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slsDetectorDefs::ROI slsDetector::getROI() {
|
||||||
|
int fnum = F_GET_ROI;
|
||||||
|
int ret = FAIL;
|
||||||
|
FILE_LOG(logDEBUG1) << "Getting ROI from detector";
|
||||||
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
|
client.Send(&fnum, sizeof(fnum));
|
||||||
|
client.Receive(&ret, sizeof(ret));
|
||||||
|
// handle ret
|
||||||
|
if (ret == FAIL) {
|
||||||
|
char mess[MAX_STR_LENGTH]{};
|
||||||
|
client.Receive(mess, MAX_STR_LENGTH);
|
||||||
|
throw RuntimeError("Detector " + std::to_string(detId) +
|
||||||
|
" returned error: " + std::string(mess));
|
||||||
|
} else {
|
||||||
|
ROI retval;
|
||||||
|
client.Receive(&retval.xmin, sizeof(int));
|
||||||
|
client.Receive(&retval.xmax, sizeof(int));
|
||||||
|
FILE_LOG(logDEBUG1)
|
||||||
|
<< "ROI retval [" << retval.xmin << ","
|
||||||
|
<< retval.xmax << "]";
|
||||||
|
if (ret == FORCE_UPDATE) {
|
||||||
|
updateCachedDetectorVariables();
|
||||||
|
}
|
||||||
|
// if different from shm, update and send to receiver
|
||||||
|
if (shm()->roi.xmin != retval.xmin || shm()->roi.xmax != retval.xmax) {
|
||||||
|
memcpy(&shm()->roi, &retval, sizeof(ROI));
|
||||||
|
sendROItoReceiver();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return shm()->roi;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void slsDetector::setADCEnableMask(uint32_t mask) {
|
void slsDetector::setADCEnableMask(uint32_t mask) {
|
||||||
uint32_t arg = mask;
|
uint32_t arg = mask;
|
||||||
FILE_LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex << arg
|
FILE_LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex << arg
|
||||||
|
@ -308,7 +308,14 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page config
|
/*! \page config
|
||||||
- <b>roi [i] [xmin] [xmax] [ymin] [ymax] </b> sets region of interest of the detector, where i is number of rois;i=0 to clear rois. Used for GOTTHARD only. \c Returns \c (int)
|
- <b>clearroi </b> resets region of interest of the detector. Used for GOTTHARD only. \c Returns \c (string)
|
||||||
|
*/
|
||||||
|
descrToFuncMap[i].m_pFuncName = "clearroi";
|
||||||
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDetectorSize;
|
||||||
|
++i;
|
||||||
|
|
||||||
|
/*! \page config
|
||||||
|
- <b>roi [xmin] [xmax] </b> sets region of interest of the detector. Used for GOTTHARD only. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "roi";
|
descrToFuncMap[i].m_pFuncName = "roi";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDetectorSize;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDetectorSize;
|
||||||
@ -3252,28 +3259,28 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
|
|||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpDetectorSize(action);
|
return helpDetectorSize(action);
|
||||||
int ret, val = -1, pos = -1, i;
|
int ret, val = -1;
|
||||||
char ans[1000];
|
char ans[1000];
|
||||||
|
|
||||||
|
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (!sscanf(args[1], "%d", &val))
|
if (cmd != "roi" && !sscanf(args[1], "%d", &val))
|
||||||
return std::string("could not scan ") + std::string(args[0]) + std::string(" ") + std::string(args[1]);
|
return std::string("could not scan ") + std::string(args[0]) + std::string(" ") + std::string(args[1]);
|
||||||
|
|
||||||
|
if (cmd == "clearroi") {
|
||||||
|
myDet->clearROI(detPos);
|
||||||
|
}
|
||||||
|
|
||||||
if (cmd == "roi") {
|
if (cmd == "roi") {
|
||||||
//debug number of arguments
|
//debug number of arguments
|
||||||
if ((val < 0) || (narg != ((val * 4) + 2)))
|
if (narg != 3)
|
||||||
return helpDetectorSize(action);
|
return helpDetectorSize(action);
|
||||||
ROI allroi[val];
|
ROI roi;
|
||||||
pos = 2;
|
if (!sscanf(args[1], "%d", &roi.xmin))
|
||||||
for (i = 0; i < val; ++i) {
|
return std::string("cannot parse arguments for roi xmin");
|
||||||
if ((!sscanf(args[pos++], "%d", &allroi[i].xmin)) ||
|
if (!sscanf(args[2], "%d", &roi.xmax))
|
||||||
(!sscanf(args[pos++], "%d", &allroi[i].xmax)) ||
|
return std::string("cannot parse arguments for roi xmax");
|
||||||
(!sscanf(args[pos++], "%d", &allroi[i].ymin)) ||
|
myDet->setROI(roi, detPos);
|
||||||
(!sscanf(args[pos++], "%d", &allroi[i].ymax)))
|
|
||||||
return std::string("cannot parse arguments for roi");
|
|
||||||
}
|
|
||||||
myDet->setROI(val, allroi, detPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd == "detsizechan") {
|
if (cmd == "detsizechan") {
|
||||||
@ -3308,17 +3315,21 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
|
|||||||
if ((!sscanf(args[1], "%d", &val)) || (val != 0 && val != 1))
|
if ((!sscanf(args[1], "%d", &val)) || (val != 0 && val != 1))
|
||||||
return std::string("cannot scan gappixels mode: must be 0 or 1");
|
return std::string("cannot scan gappixels mode: must be 0 or 1");
|
||||||
|
|
||||||
if (detPos < 0) // only in multi detector level to update offsets etc.
|
if (detPos < 0) // only in multi detector level to update number of channels etc.
|
||||||
myDet->enableGapPixels(val, detPos);
|
myDet->enableGapPixels(val, detPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd == "dr") {
|
if (cmd == "dr") {
|
||||||
ret = myDet->setDynamicRange(val, detPos);
|
ret = myDet->setDynamicRange(val, detPos);
|
||||||
|
} else if (cmd == "clearroi") {
|
||||||
|
if (action == GET_ACTION) {
|
||||||
|
return std::string("Cannot get");
|
||||||
|
}
|
||||||
|
return std::string("successful");
|
||||||
} else if (cmd == "roi") {
|
} else if (cmd == "roi") {
|
||||||
const ROI* r = myDet->getROI(ret, detPos);
|
ROI roi = myDet->getROI(detPos);
|
||||||
|
return (std::string("[") + std::to_string(roi.xmin) + std::string(",") + std::to_string(roi.xmax) + std::string("]"));
|
||||||
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 std::string(ans);
|
return std::string(ans);
|
||||||
@ -3330,7 +3341,7 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
|
|||||||
return std::string("Not required for this detector\n");
|
return std::string("Not required for this detector\n");
|
||||||
ret = myDet->getFlippedData(Y, detPos);
|
ret = myDet->getFlippedData(Y, detPos);
|
||||||
} else if (cmd == "gappixels") {
|
} else if (cmd == "gappixels") {
|
||||||
if (detPos >= 0) // only in multi detector level to update offsets etc.
|
if (detPos >= 0) // only in multi detector level to update number of channels etc.
|
||||||
return std::string("Cannot execute this command from slsDetector level. Please use multiSlsDetector level.\n");
|
return std::string("Cannot execute this command from slsDetector level. Please use multiSlsDetector level.\n");
|
||||||
ret = myDet->enableGapPixels(-1, detPos);
|
ret = myDet->enableGapPixels(-1, detPos);
|
||||||
}
|
}
|
||||||
@ -3349,7 +3360,8 @@ std::string slsDetectorCommand::helpDetectorSize(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
os << "dr i \n sets the dynamic range of the detector" << std::endl;
|
os << "dr i \n sets the dynamic range of the detector" << std::endl;
|
||||||
os << "roi i xmin xmax ymin ymax \n sets region of interest where i is number of rois;i=0 to clear rois" << std::endl;
|
os << "clearroi \n resets region of interest" << std::endl;
|
||||||
|
os << "roi xmin xmax \n sets region of interest " << std::endl;
|
||||||
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 is no limit" << std::endl;
|
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 is no limit" << std::endl;
|
||||||
os << "quad i \n if i = 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
|
os << "quad i \n if i = 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
|
||||||
os << "flippeddatax x \n sets if the data should be flipped on the x axis" << std::endl;
|
os << "flippeddatax x \n sets if the data should be flipped on the x axis" << std::endl;
|
||||||
|
@ -14,14 +14,7 @@ int slsDetectorUsers::getMaximumDetectorSize(int &nx, int &ny){
|
|||||||
return nx*ny;
|
return nx*ny;
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::getDetectorSize(int &x, int &y, int &nx, int &ny, int detPos){
|
int slsDetectorUsers::getDetectorSize(int &nx, int &ny, int detPos){
|
||||||
if (detPos < 0) {
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
} else {
|
|
||||||
x = detector.getDetectorOffset(slsDetectorDefs::X, detPos);
|
|
||||||
y = detector.getDetectorOffset(slsDetectorDefs::Y, detPos);
|
|
||||||
}
|
|
||||||
nx=detector.getTotalNumberOfChannels(slsDetectorDefs::X, detPos);
|
nx=detector.getTotalNumberOfChannels(slsDetectorDefs::X, detPos);
|
||||||
ny=detector.getTotalNumberOfChannels(slsDetectorDefs::Y, detPos);
|
ny=detector.getTotalNumberOfChannels(slsDetectorDefs::Y, detPos);
|
||||||
return nx*ny;
|
return nx*ny;
|
||||||
@ -226,12 +219,12 @@ int slsDetectorUsers::setFlowControl10G(int i, int detPos) {
|
|||||||
return detector.setFlowControl10G(i, detPos);
|
return detector.setFlowControl10G(i, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void slsDetectorUsers::setROI(int n, slsDetectorDefs::ROI roiLimits[], int detPos) {
|
void slsDetectorUsers::setROI(slsDetectorDefs::ROI arg, int detPos) {
|
||||||
detector.setROI(n, roiLimits, detPos);
|
detector.setROI(arg, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
const slsDetectorDefs::ROI* slsDetectorUsers::getROI(int &n, int detPos) {
|
slsDetectorDefs::ROI slsDetectorUsers::getROI(int detPos) {
|
||||||
return detector.getROI(n, detPos);
|
return detector.getROI(detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -32,7 +32,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
* @param nd pointer to number of detectors in each dimension
|
* @param nd pointer to number of detectors in each dimension
|
||||||
* @param gpEnable pointer to gap pixels enable
|
* @param gpEnable pointer to gap pixels enable
|
||||||
*/
|
*/
|
||||||
DataStreamer(int ind, Fifo* f, uint32_t* dr, std::vector<ROI>* r,
|
DataStreamer(int ind, Fifo* f, uint32_t* dr, ROI* r,
|
||||||
uint64_t* fi, int fd, char* ajh, int* nd, bool* gpEnable);
|
uint64_t* fi, int fd, char* ajh, int* nd, bool* gpEnable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -188,7 +188,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
uint32_t* dynamicRange;
|
uint32_t* dynamicRange;
|
||||||
|
|
||||||
/** ROI */
|
/** ROI */
|
||||||
std::vector<ROI>* roi;
|
ROI* roi;
|
||||||
|
|
||||||
/** adc Configured */
|
/** adc Configured */
|
||||||
int adcConfigured;
|
int adcConfigured;
|
||||||
|
@ -142,17 +142,17 @@ public:
|
|||||||
* Set ROI
|
* Set ROI
|
||||||
* @param i ROI
|
* @param i ROI
|
||||||
*/
|
*/
|
||||||
virtual void SetROI(std::vector<slsDetectorDefs::ROI> i) {
|
virtual void SetROI(slsDetectorDefs::ROI i) {
|
||||||
FILE_LOG(logERROR) << "SetROI is a generic function that should be overloaded by a derived class";
|
FILE_LOG(logERROR) << "SetROI is a generic function that should be overloaded by a derived class";
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Adc configured
|
* Get Adc configured
|
||||||
* @param index thread index for debugging purposes
|
* @param index thread index for debugging purposes
|
||||||
* @param i pointer to a vector of ROI pointers
|
* @param ROI
|
||||||
* @returns adc configured
|
* @returns adc configured
|
||||||
*/
|
*/
|
||||||
virtual int GetAdcConfigured(int index, std::vector<slsDetectorDefs::ROI>* i) const{
|
virtual int GetAdcConfigured(int index, slsDetectorDefs::ROI i) const{
|
||||||
FILE_LOG(logERROR) << "GetAdcConfigured is a generic function that should be overloaded by a derived class";
|
FILE_LOG(logERROR) << "GetAdcConfigured is a generic function that should be overloaded by a derived class";
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
@ -311,9 +311,9 @@ private:
|
|||||||
* Set ROI
|
* Set ROI
|
||||||
* @param i ROI
|
* @param i ROI
|
||||||
*/
|
*/
|
||||||
void SetROI(std::vector<slsDetectorDefs::ROI> i) {
|
void SetROI(slsDetectorDefs::ROI i) {
|
||||||
// all adcs
|
// all adcs
|
||||||
if(!i.size()) {
|
if(i.xmin == -1) {
|
||||||
nPixelsX = 1280;
|
nPixelsX = 1280;
|
||||||
dataSize = 1280;
|
dataSize = 1280;
|
||||||
packetSize = GOTTHARD_PACKET_SIZE;
|
packetSize = GOTTHARD_PACKET_SIZE;
|
||||||
@ -352,22 +352,16 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Get Adc configured
|
* Get Adc configured
|
||||||
* @param index thread index for debugging purposes
|
* @param index thread index for debugging purposes
|
||||||
* @param i pointer to a vector of ROI
|
* @param i ROI
|
||||||
* @returns adc configured
|
* @returns adc configured
|
||||||
*/
|
*/
|
||||||
int GetAdcConfigured(int index, std::vector<slsDetectorDefs::ROI>* i) const{
|
int GetAdcConfigured(int index, slsDetectorDefs::ROI i) const{
|
||||||
int adc = -1;
|
int adc = -1;
|
||||||
// single adc
|
// single adc
|
||||||
if(i->size()) {
|
if(i.xmin != -1) {
|
||||||
// gotthard can have only one adc per detector enabled (or all)
|
// gotthard can have only one adc per detector enabled (or all)
|
||||||
// so just looking at the first roi is enough (more not possible at the moment)
|
|
||||||
|
|
||||||
//if its for 1 adc or general
|
|
||||||
if ((i->at(0).xmin == 0) && (i->at(0).xmax == nChip * nChan))
|
|
||||||
adc = -1;
|
|
||||||
else {
|
|
||||||
//adc = mid value/numchans also for only 1 roi
|
//adc = mid value/numchans also for only 1 roi
|
||||||
adc = ((((i->at(0).xmax) + (i->at(0).xmin))/2)/
|
adc = ((((i.xmax) + (i.xmin))/2)/
|
||||||
(nChan * nChipsPerAdc));
|
(nChan * nChipsPerAdc));
|
||||||
if((adc < 0) || (adc > 4)) {
|
if((adc < 0) || (adc > 4)) {
|
||||||
FILE_LOG(logWARNING) << index << ": Deleting ROI. "
|
FILE_LOG(logWARNING) << index << ": Deleting ROI. "
|
||||||
@ -375,7 +369,6 @@ private:
|
|||||||
adc = -1;
|
adc = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
FILE_LOG(logINFO) << "Adc Configured: " << adc;
|
FILE_LOG(logINFO) << "Adc Configured: " << adc;
|
||||||
return adc;
|
return adc;
|
||||||
};
|
};
|
||||||
|
@ -207,9 +207,9 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
|||||||
//***acquisition parameters***
|
//***acquisition parameters***
|
||||||
/**
|
/**
|
||||||
* Get ROI
|
* Get ROI
|
||||||
* @return index of adc enabled, else -1 if all enabled
|
* @return roi
|
||||||
*/
|
*/
|
||||||
std::vector<ROI> getROI() const;
|
ROI getROI() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ADC Enable Mask
|
* Get ADC Enable Mask
|
||||||
@ -529,10 +529,10 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
|||||||
//***acquisition parameters***
|
//***acquisition parameters***
|
||||||
/**
|
/**
|
||||||
* Set ROI
|
* Set ROI
|
||||||
* @param i ROI
|
* @param arg ROI
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
int setROI(const std::vector<ROI> new_roi);
|
int setROI(ROI arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ADC Enable Mask
|
* Set ADC Enable Mask
|
||||||
@ -961,7 +961,7 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
|||||||
|
|
||||||
//***acquisition parameters***
|
//***acquisition parameters***
|
||||||
/* ROI */
|
/* ROI */
|
||||||
std::vector<ROI> roi;
|
ROI roi;
|
||||||
/** ADC Enable Mask */
|
/** ADC Enable Mask */
|
||||||
uint32_t adcEnableMask;
|
uint32_t adcEnableMask;
|
||||||
/** streaming frequency */
|
/** streaming frequency */
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||||
|
|
||||||
|
|
||||||
DataStreamer::DataStreamer(int ind, Fifo* f, uint32_t* dr, std::vector<ROI>* r,
|
DataStreamer::DataStreamer(int ind, Fifo* f, uint32_t* dr, ROI* r,
|
||||||
uint64_t* fi, int fd, char* ajh, int* nd, bool* gpEnable) :
|
uint64_t* fi, int fd, char* ajh, int* nd, bool* gpEnable) :
|
||||||
ThreadObject(ind),
|
ThreadObject(ind),
|
||||||
runningFlag(0),
|
runningFlag(0),
|
||||||
@ -93,9 +93,9 @@ void DataStreamer::ResetParametersforNewMeasurement(const std::string& fname){
|
|||||||
delete[] completeBuffer;
|
delete[] completeBuffer;
|
||||||
completeBuffer = nullptr;
|
completeBuffer = nullptr;
|
||||||
}
|
}
|
||||||
if (roi->size()) {
|
if (roi->xmin != -1) {
|
||||||
if (generalData->myDetectorType == GOTTHARD) {
|
if (generalData->myDetectorType == GOTTHARD) {
|
||||||
adcConfigured = generalData->GetAdcConfigured(index, roi);
|
adcConfigured = generalData->GetAdcConfigured(index, *roi);
|
||||||
}
|
}
|
||||||
completeBuffer = new char[generalData->imageSizeComplete];
|
completeBuffer = new char[generalData->imageSizeComplete];
|
||||||
memset(completeBuffer, 0, generalData->imageSizeComplete);
|
memset(completeBuffer, 0, generalData->imageSizeComplete);
|
||||||
|
@ -104,7 +104,8 @@ void slsReceiverImplementation::InitializeMembers() {
|
|||||||
overwriteEnable = true;
|
overwriteEnable = true;
|
||||||
|
|
||||||
//***acquisition parameters***
|
//***acquisition parameters***
|
||||||
roi.clear();
|
roi.xmin = -1;
|
||||||
|
roi.xmax = -1;
|
||||||
adcEnableMask = BIT32_MASK;
|
adcEnableMask = BIT32_MASK;
|
||||||
streamingFrequency = 0;
|
streamingFrequency = 0;
|
||||||
streamingTimerInMs = DEFAULT_STREAMING_TIMER_IN_MS;
|
streamingTimerInMs = DEFAULT_STREAMING_TIMER_IN_MS;
|
||||||
@ -305,7 +306,7 @@ int slsReceiverImplementation::getNumberofUDPInterfaces() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/***acquisition parameters***/
|
/***acquisition parameters***/
|
||||||
std::vector<slsDetectorDefs::ROI> slsReceiverImplementation::getROI() const {
|
slsDetectorDefs::ROI slsReceiverImplementation::getROI() const {
|
||||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||||
return roi;
|
return roi;
|
||||||
}
|
}
|
||||||
@ -858,51 +859,21 @@ int slsReceiverImplementation::setUDPSocketBufferSize(const int64_t s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/***acquisition parameters***/
|
/***acquisition parameters***/
|
||||||
int slsReceiverImplementation::setROI(
|
int slsReceiverImplementation::setROI(slsDetectorDefs::ROI arg) {
|
||||||
const std::vector<slsDetectorDefs::ROI> new_roi) {
|
if (roi.xmin != arg.xmin || roi.xmax != arg.xmax) {
|
||||||
bool change = false;
|
roi.xmin = arg.xmin;
|
||||||
if (roi.size() != new_roi.size())
|
roi.xmax = arg.xmax;
|
||||||
change = true;
|
|
||||||
else {
|
|
||||||
for (size_t i = 0; i != new_roi.size(); ++i) {
|
|
||||||
if ((roi[i].xmin != new_roi[i].xmin) ||
|
|
||||||
(roi[i].xmax != new_roi[i].xmax) ||
|
|
||||||
(roi[i].ymin != new_roi[i].ymin) ||
|
|
||||||
(roi[i].xmax != new_roi[i].xmax)) {
|
|
||||||
change = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
// only for gotthard
|
||||||
roi = new_roi;
|
generalData->SetROI(arg);
|
||||||
switch (myDetectorType) {
|
|
||||||
case GOTTHARD:
|
|
||||||
generalData->SetROI(new_roi);
|
|
||||||
framesPerFile = generalData->maxFramesPerFile;
|
framesPerFile = generalData->maxFramesPerFile;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (const auto &it : dataProcessor)
|
for (const auto &it : dataProcessor)
|
||||||
it->SetPixelDimension();
|
it->SetPixelDimension();
|
||||||
if (SetupFifoStructure() == FAIL)
|
if (SetupFifoStructure() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream sstm;
|
FILE_LOG(logINFO) << "ROI: [" << roi.xmin << ", " << roi.xmax << "]";;
|
||||||
sstm << "ROI: ";
|
|
||||||
if (!roi.size())
|
|
||||||
sstm << "0";
|
|
||||||
else {
|
|
||||||
for (size_t i = 0; i < roi.size(); ++i) {
|
|
||||||
sstm << "( " << roi[i].xmin << ", " << roi[i].xmax << ", "
|
|
||||||
<< roi[i].ymin << ", " << roi[i].ymax << " )";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::string message = sstm.str();
|
|
||||||
FILE_LOG(logINFO) << message;
|
|
||||||
FILE_LOG(logINFO) << "Packets per Frame: "
|
FILE_LOG(logINFO) << "Packets per Frame: "
|
||||||
<< (generalData->packetsPerFrame);
|
<< (generalData->packetsPerFrame);
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -510,22 +510,12 @@ int slsReceiverTCPIPInterface::set_detector_hostname(Interface &socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::set_roi(Interface &socket) {
|
int slsReceiverTCPIPInterface::set_roi(Interface &socket) {
|
||||||
static_assert(sizeof(ROI) == 4 * sizeof(int), "ROI not packed");
|
static_assert(sizeof(ROI) == 2 * sizeof(int), "ROI not packed");
|
||||||
auto narg = socket.Receive<int>();
|
ROI arg;
|
||||||
std::vector<ROI> arg;
|
socket.Receive(arg);
|
||||||
for (int iloop = 0; iloop < narg; ++iloop) {
|
FILE_LOG(logDEBUG1) << "Set ROI: [" << arg.xmin << ", " << arg.xmax << "]";
|
||||||
ROI temp{};
|
|
||||||
socket.Receive(temp);
|
|
||||||
arg.push_back(temp);
|
|
||||||
}
|
|
||||||
FILE_LOG(logDEBUG1) << "Set ROI narg: " << narg;
|
|
||||||
for (int iloop = 0; iloop < narg; ++iloop) {
|
|
||||||
FILE_LOG(logDEBUG1)
|
|
||||||
<< "(" << arg[iloop].xmin << ", " << arg[iloop].xmax << ", "
|
|
||||||
<< arg[iloop].ymin << ", " << arg[iloop].ymax << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myDetectorType == EIGER || myDetectorType == JUNGFRAU)
|
if (myDetectorType != GOTTHARD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
|
|
||||||
VerifyIdle(socket);
|
VerifyIdle(socket);
|
||||||
|
@ -220,12 +220,18 @@ format
|
|||||||
@short structure for a region of interest
|
@short structure for a region of interest
|
||||||
xmin,xmax,ymin,ymax define the limits of the region
|
xmin,xmax,ymin,ymax define the limits of the region
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
struct ROI {
|
||||||
|
int xmin{-1}; /**< is the roi xmin (in channel number) */
|
||||||
|
int xmax{-1}; /**< is the roi xmax (in channel number)*/
|
||||||
|
};
|
||||||
|
#else
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int xmin; /**< is the roi xmin (in channel number) */
|
int xmin; /**< is the roi xmin (in channel number) */
|
||||||
int xmax; /**< is the roi xmax (in channel number)*/
|
int xmax; /**< is the roi xmax (in channel number)*/
|
||||||
int ymin; /**< is the roi ymin (in channel number)*/
|
|
||||||
int ymax; /**< is the roi ymax (in channel number)*/
|
|
||||||
} ROI;
|
} ROI;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
network parameters
|
network parameters
|
||||||
|
@ -35,6 +35,7 @@ enum detFuncs{
|
|||||||
F_SET_DYNAMIC_RANGE, /**< set/get detector dynamic range */
|
F_SET_DYNAMIC_RANGE, /**< set/get detector dynamic range */
|
||||||
F_SET_READOUT_FLAGS, /**< set/get readout flags */
|
F_SET_READOUT_FLAGS, /**< set/get readout flags */
|
||||||
F_SET_ROI, /**< set/get region of interest */
|
F_SET_ROI, /**< set/get region of interest */
|
||||||
|
F_GET_ROI,
|
||||||
F_SET_SPEED, /**< set/get readout speed parameters */
|
F_SET_SPEED, /**< set/get readout speed parameters */
|
||||||
F_EXIT_SERVER, /**< turn off detector server */
|
F_EXIT_SERVER, /**< turn off detector server */
|
||||||
F_LOCK_SERVER, /**< Locks/Unlocks server communication to the given client */
|
F_LOCK_SERVER, /**< Locks/Unlocks server communication to the given client */
|
||||||
@ -185,6 +186,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
|
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
|
||||||
case F_SET_READOUT_FLAGS: return "F_SET_READOUT_FLAGS";
|
case F_SET_READOUT_FLAGS: return "F_SET_READOUT_FLAGS";
|
||||||
case F_SET_ROI: return "F_SET_ROI";
|
case F_SET_ROI: return "F_SET_ROI";
|
||||||
|
case F_GET_ROI: return "F_GET_ROI";
|
||||||
case F_SET_SPEED: return "F_SET_SPEED";
|
case F_SET_SPEED: return "F_SET_SPEED";
|
||||||
case F_EXIT_SERVER: return "F_EXIT_SERVER";
|
case F_EXIT_SERVER: return "F_EXIT_SERVER";
|
||||||
case F_LOCK_SERVER: return "F_LOCK_SERVER";
|
case F_LOCK_SERVER: return "F_LOCK_SERVER";
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#define GITBRANCH "developer"
|
#define GITBRANCH "developer"
|
||||||
#define APIMOENCH 0x181108
|
#define APIMOENCH 0x181108
|
||||||
#define APICTB 0x190604
|
#define APICTB 0x190604
|
||||||
#define APIGOTTHARD 0x190715
|
|
||||||
#define APILIB 0x190723
|
#define APILIB 0x190723
|
||||||
#define APIRECEIVER 0x190722
|
#define APIRECEIVER 0x190722
|
||||||
#define APIGUI 0x190723
|
#define APIGUI 0x190723
|
||||||
#define APIJUNGFRAU 0x190730
|
#define APIJUNGFRAU 0x190730
|
||||||
#define APIEIGER 0x190809
|
#define APIGOTTHARD 0x190813
|
||||||
|
#define APIEIGER 0x190814
|
||||||
|
Loading…
x
Reference in New Issue
Block a user