mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
included setroi for multidet
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@145 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -51,11 +51,70 @@
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideLeft</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Logs</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="boxLogs">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>10</y>
|
||||
<width>746</width>
|
||||
<height>66</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Calibration Logs</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>20</y>
|
||||
<width>313</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>42</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkEnergyLog">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Energy Calibration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkAngularLog">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angular Calibration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Trimming</string>
|
||||
@ -682,130 +741,129 @@ An extension given by the modules serial number will be attached.
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Logs</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="boxLogs">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>10</y>
|
||||
<width>746</width>
|
||||
<height>66</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Calibration Logs</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>20</y>
|
||||
<width>313</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>42</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkEnergyLog">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Energy Calibration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkAngularLog">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angular Calibration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>Readout</string>
|
||||
<string>Region of Interest</string>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_3">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>136</width>
|
||||
<height>31</height>
|
||||
<y>50</y>
|
||||
<width>736</width>
|
||||
<height>246</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>42</number>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="roiWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>736</width>
|
||||
<height>246</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>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>5</y>
|
||||
<width>736</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblADC">
|
||||
<property name="text">
|
||||
<string>ADC:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboADC">
|
||||
<widget class="QPushButton" name="btnGetRoi">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>5</number>
|
||||
<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>
|
||||
<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>
|
||||
<widget class="QPushButton" name="btnSetRoi">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</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>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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>
|
||||
<widget class="QPushButton" name="btnClearRoi">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> Clear ROI </string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/close.png</normaloff>:/icons/images/close.png</iconset>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -962,9 +1020,6 @@ An extension given by the modules serial number will be attached.
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<zorder>gridLayoutWidget_5</zorder>
|
||||
<zorder>dispFileName</zorder>
|
||||
<zorder>gridLayoutWidget_7</zorder>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="boxRxrPorts">
|
||||
<property name="geometry">
|
||||
@ -1470,7 +1525,11 @@ An extension given by the modules serial number will be attached.
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set Receiver</string>
|
||||
<string> Set Receiver</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnConfigure">
|
||||
@ -1483,7 +1542,11 @@ An extension given by the modules serial number will be attached.
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Configure MAC</string>
|
||||
<string> Configure MAC</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -15,5 +15,6 @@
|
||||
<file>../images/stop.png</file>
|
||||
<file>../images/leftArrow.png</file>
|
||||
<file>../images/rightArrow.png</file>
|
||||
<file>../images/upload.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -9,17 +9,18 @@
|
||||
#define QTABADVANCED_H_
|
||||
|
||||
#include "qDefs.h"
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_advanced.h"
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
class slsDetector;
|
||||
/** Qt Project Class Headers */
|
||||
class qDrawPlot;
|
||||
/** Qt Include Header */
|
||||
#include <QStackedLayout>
|
||||
|
||||
#include <QSpacerItem>
|
||||
/**
|
||||
*@short sets up the advanced parameters
|
||||
*/
|
||||
@ -52,14 +53,13 @@ private:
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
|
||||
/** Add ROI Input
|
||||
* @param num number of inputs to add
|
||||
*/
|
||||
void AddROIInput(int num);
|
||||
|
||||
private slots:
|
||||
|
||||
/** Set ADC Readout
|
||||
*/
|
||||
void SetADCReadout(int i);
|
||||
|
||||
/** Enable/Disable Energy and Calibration Logs
|
||||
*/
|
||||
void SetLogs();
|
||||
@ -146,6 +146,26 @@ private slots:
|
||||
*/
|
||||
void Configuremac();
|
||||
|
||||
/** Add ROI Input if the value changed in the last slot
|
||||
*/
|
||||
void AddROIInputSlot(){AddROIInput(1);};
|
||||
|
||||
/** Clears all the ROI inputs
|
||||
*/
|
||||
void clearROI();
|
||||
|
||||
/** Gets ROIs from detector and updates it
|
||||
*/
|
||||
void updateROIList();
|
||||
|
||||
/** Sets ROI in detector
|
||||
*/
|
||||
void setROI();
|
||||
|
||||
/** Clears ROI in detector
|
||||
*/
|
||||
void clearROIinDetector();
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
@ -172,6 +192,23 @@ private:
|
||||
bool isEnergy;
|
||||
bool isAngular;
|
||||
|
||||
/**sls detector obejct*/
|
||||
slsDetector *det;
|
||||
|
||||
|
||||
/** ROI */
|
||||
vector <QLabel*> lblFromX;
|
||||
vector <QSpinBox*> spinFromX;
|
||||
vector <QLabel*> lblFromY;
|
||||
vector <QSpinBox*> spinFromY;
|
||||
vector <QLabel*> lblToX;
|
||||
vector <QSpinBox*> spinToX;
|
||||
vector <QLabel*> lblToY;
|
||||
vector <QSpinBox*> spinToY;
|
||||
int numRois;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -101,13 +101,15 @@ void qDetectorMain::SetUpWidgetWindow(){
|
||||
tabs = new MyTabWidget(this);
|
||||
layoutTabs->addWidget(tabs);
|
||||
|
||||
int numDet = myDet->getNumberOfDetectors();
|
||||
|
||||
// creating all the other tab widgets
|
||||
tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"<<endl;
|
||||
tab_dataoutput = new qTabDataOutput (this, myDet); cout<<"DataOutput ready"<<endl;
|
||||
tab_plot = new qTabPlot (this, myDet,myPlot); cout<<"Plot ready"<<endl;
|
||||
tab_actions = new qTabActions (this, myDet); cout<<"Actions ready"<<endl;
|
||||
tab_settings = new qTabSettings (this, myDet); cout<<"Settings ready"<<endl;
|
||||
tab_advanced = new qTabAdvanced (this, myDet,myPlot); cout<<"Advanced ready"<<endl;
|
||||
tab_advanced = new qTabAdvanced (this, myDet,myPlot,numDet);cout<<"Advanced ready"<<endl;
|
||||
tab_debugging = new qTabDebugging (this, myDet); cout<<"Debugging ready"<<endl;
|
||||
tab_developer = new qTabDeveloper (this, myDet); cout<<"Developer ready"<<endl;
|
||||
|
||||
|
@ -42,9 +42,6 @@ void qTabAdvanced::SetupWidgetWindow(){
|
||||
|
||||
//executed even for non digital, so make sure its necessary
|
||||
|
||||
//readout adc
|
||||
lblADC->setEnabled(false);
|
||||
comboADC->setEnabled(false);
|
||||
//Network
|
||||
lblIP->setEnabled(false);
|
||||
lblMAC->setEnabled(false);
|
||||
@ -75,8 +72,6 @@ void qTabAdvanced::SetupWidgetWindow(){
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
isEnergy = false;
|
||||
isAngular = true;
|
||||
lblADC->setEnabled(true);
|
||||
comboADC->setEnabled(true);
|
||||
lblIP->setEnabled(true);
|
||||
lblMAC->setEnabled(true);
|
||||
dispIP->setEnabled(true);
|
||||
@ -142,6 +137,9 @@ void qTabAdvanced::SetupWidgetWindow(){
|
||||
}
|
||||
|
||||
|
||||
//updates roi
|
||||
updateROIList();
|
||||
|
||||
Initialization();
|
||||
|
||||
}
|
||||
@ -194,8 +192,6 @@ void qTabAdvanced::Initialization(){
|
||||
connect(comboOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetOnline(int)));
|
||||
|
||||
if(detType==slsDetectorDefs::GOTTHARD){
|
||||
//readout
|
||||
connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int)));
|
||||
|
||||
//network
|
||||
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
|
||||
@ -212,18 +208,11 @@ void qTabAdvanced::Initialization(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabAdvanced::SetADCReadout(int i){
|
||||
|
||||
if(i==5) i=-1;
|
||||
if(myDet->configureMAC(i)==slsDetectorDefs::FAIL)
|
||||
qDefs::Message(qDefs::WARNING,"Could not configure mac","Advanced");
|
||||
else
|
||||
qDefs::Message(qDefs::WARNING,"ADC Readout successfully set up","Advanced");
|
||||
//roi
|
||||
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(clearROIinDetector()));
|
||||
connect(btnGetRoi, SIGNAL(clicked()), this, SLOT(updateROIList()));
|
||||
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(setROI()));
|
||||
}
|
||||
|
||||
|
||||
@ -643,12 +632,7 @@ void qTabAdvanced::Configuremac(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Configuring Mac:" << endl;
|
||||
#endif
|
||||
int adc = comboADC->currentIndex();
|
||||
if(adc==5) adc=-1;
|
||||
myDet->configureMAC(adc);
|
||||
// qDefs::Message(qDefs::WARNING,"Could not configure mac","Advanced");
|
||||
//else
|
||||
// qDefs::Message(qDefs::WARNING,"ADC Readout successfully set up","Advanced");
|
||||
myDet->configureMAC();
|
||||
qDefs::checkErrorMessage(myDet);
|
||||
}
|
||||
|
||||
@ -656,7 +640,234 @@ void qTabAdvanced::Configuremac(){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabAdvanced::updateROIList(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"in updateROIList() " << endl;
|
||||
#endif
|
||||
clearROI();
|
||||
|
||||
int n,i;
|
||||
slsDetectorDefs::ROI* temp = myDet->getROI(n);
|
||||
|
||||
if((temp!=NULL)&&(n>0)){
|
||||
//assign into array, else it loses values cuz of memory
|
||||
slsDetectorDefs::ROI allroi[n];
|
||||
for(i=0;i<n;i++)
|
||||
allroi[i] = temp[i];
|
||||
|
||||
//add roi inputs
|
||||
AddROIInput(n);
|
||||
//populating roi list
|
||||
for (i=0;i<n;i++){
|
||||
spinFromX[i]->setValue(allroi[i].xmin);
|
||||
spinFromY[i]->setValue(allroi[i].ymin);
|
||||
spinToX[i]->setValue(allroi[i].xmax);
|
||||
spinToY[i]->setValue(allroi[i].ymax);
|
||||
}
|
||||
cout << "ROIs populated: " << n << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabAdvanced::AddROIInput(int num){
|
||||
#ifdef VERVERBOSE
|
||||
cout<<"in AddROIInput() " << num << endl;
|
||||
#endif
|
||||
if((int)lblFromX.size()){
|
||||
disconnect(spinFromX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
disconnect(spinFromY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
disconnect(spinToX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
disconnect(spinToY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
}
|
||||
|
||||
int exists = numRois+1;
|
||||
int total = exists+num;
|
||||
//if cleared, addding just one
|
||||
if ((num==0) && (numRois==0)){
|
||||
exists = 0;
|
||||
total = 1;
|
||||
}/*else{
|
||||
gridRoi->removeWidget
|
||||
}*/
|
||||
|
||||
for (int i=exists;i<total;i++){
|
||||
|
||||
if(i >= ((int)lblFromX.size())){
|
||||
lblFromX.resize(i+1); spinFromX.resize(i+1);
|
||||
lblFromY.resize(i+1); spinFromY.resize(i+1);
|
||||
lblToX.resize(i+1); spinToX.resize(i+1);
|
||||
lblToY.resize(i+1); spinToY.resize(i+1);
|
||||
|
||||
lblFromX[i] = new QLabel("x min:");
|
||||
lblFromY[i] = new QLabel("y min:");
|
||||
lblToX[i] = new QLabel("x max:");
|
||||
lblToY[i] = new QLabel("y max:");
|
||||
spinFromX[i] = new QSpinBox();
|
||||
spinFromY[i] = new QSpinBox();
|
||||
spinToX[i] = new QSpinBox();
|
||||
spinToY[i] = new QSpinBox();
|
||||
|
||||
|
||||
lblFromX[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblFromX[i]->setFixedWidth(50);
|
||||
lblFromY[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblFromY[i]->setFixedWidth(50);
|
||||
lblToX[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblToX[i]->setFixedWidth(50);
|
||||
lblToY[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lblToY[i]->setFixedWidth(50);
|
||||
spinFromX[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); spinFromX[i]->setFixedWidth(80);
|
||||
spinFromY[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); spinFromY[i]->setFixedWidth(80);
|
||||
spinToX[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); spinToX[i]->setFixedWidth(80);
|
||||
spinToY[i]->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); spinToY[i]->setFixedWidth(80);
|
||||
spinFromX[i]->setFixedHeight(19);
|
||||
spinFromY[i]->setFixedHeight(19);
|
||||
spinToX[i]->setFixedHeight(19);
|
||||
spinToY[i]->setFixedHeight(19);
|
||||
|
||||
spinFromX[i]->setMaximum(myDet->getMaxNumberOfChannels(slsDetectorDefs::X)-1);
|
||||
spinToX[i]->setMaximum(myDet->getMaxNumberOfChannels(slsDetectorDefs::X)-1);
|
||||
spinFromY[i]->setMaximum(myDet->getMaxNumberOfChannels(slsDetectorDefs::Y)-1);
|
||||
spinToY[i]->setMaximum(myDet->getMaxNumberOfChannels(slsDetectorDefs::Y)-1);
|
||||
spinFromX[i]->setMinimum(-1);
|
||||
spinToX[i]->setMinimum(-1);
|
||||
spinFromY[i]->setMinimum(-1);
|
||||
spinToY[i]->setMinimum(-1);
|
||||
spinFromX[i]->setValue(-1);
|
||||
spinFromY[i]->setValue(-1);
|
||||
spinToX[i]->setValue(-1);
|
||||
spinToY[i]->setValue(-1);
|
||||
}
|
||||
|
||||
gridRoi->addWidget(lblFromX[i], i,0,Qt::AlignTop);
|
||||
gridRoi->addWidget(spinFromX[i],i,1,Qt::AlignTop);
|
||||
gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,2,Qt::AlignTop);
|
||||
gridRoi->addWidget(lblToX[i], i,3,Qt::AlignTop);
|
||||
gridRoi->addWidget(spinToX[i], i,4,Qt::AlignTop);
|
||||
gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,5,Qt::AlignTop);
|
||||
gridRoi->addWidget(lblFromY[i], i,6,Qt::AlignTop);
|
||||
gridRoi->addWidget(spinFromY[i],i,7,Qt::AlignTop);
|
||||
gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,8,Qt::AlignTop);
|
||||
gridRoi->addWidget(lblToY[i], i,9,Qt::AlignTop);
|
||||
gridRoi->addWidget(spinToY[i], i,10,Qt::AlignTop);
|
||||
|
||||
lblFromX[i]->show();
|
||||
spinFromX[i]->show();
|
||||
lblToX[i]->show();
|
||||
spinToX[i]->show();
|
||||
lblFromY[i]->show();
|
||||
spinFromY[i]->show();
|
||||
lblToY[i]->show();
|
||||
spinToY[i]->show();
|
||||
}
|
||||
|
||||
numRois += num;
|
||||
|
||||
connect(spinFromX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
connect(spinFromY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
connect(spinToX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
connect(spinToY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"ROI Inputs added " << num << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabAdvanced::clearROI(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"in clearROI() " << endl;
|
||||
#endif
|
||||
if((int)lblFromX.size()){
|
||||
disconnect(spinFromX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
disconnect(spinFromY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
disconnect(spinToX[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
disconnect(spinToY[numRois], SIGNAL(valueChanged(int)), this, SLOT(AddROIInputSlot()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (int i=0;i<numRois;i++){
|
||||
spinFromX[i]->setValue(-1);
|
||||
spinFromY[i]->setValue(-1);
|
||||
spinToX[i]->setValue(-1);
|
||||
spinToY[i]->setValue(-1);
|
||||
}
|
||||
|
||||
|
||||
//hide widget because they are still visible even when removed and layout deleted
|
||||
QLayoutItem *item;
|
||||
while((item = gridRoi->takeAt(0))) {
|
||||
if (item->widget()){
|
||||
item->widget()->hide();
|
||||
gridRoi->removeWidget(item->widget());
|
||||
}
|
||||
//if (item->spacerItem())
|
||||
}
|
||||
|
||||
numRois = 0;
|
||||
AddROIInput(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabAdvanced::setROI(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"in setROI() " << endl;
|
||||
#endif
|
||||
|
||||
slsDetectorDefs::ROI allroi[MAX_ROIS];
|
||||
|
||||
for (int i=0;i<numRois;i++){
|
||||
allroi[i].xmin = spinFromX[i]->value();
|
||||
allroi[i].ymin = spinFromY[i]->value();
|
||||
allroi[i].xmax = spinToX[i]->value();
|
||||
allroi[i].ymax = spinToY[i]->value();
|
||||
}
|
||||
|
||||
myDet->setROI(numRois,allroi);
|
||||
//qDefs::checkErrorMessage(myDet);
|
||||
cout<<"ROIs set" << endl;
|
||||
//get the correct list back
|
||||
updateROIList();
|
||||
//configuremac
|
||||
myDet->configureMAC();
|
||||
qDefs::checkErrorMessage(myDet);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabAdvanced::clearROIinDetector(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"in clearROIinDetector() " << endl;
|
||||
#endif
|
||||
|
||||
if (QMessageBox::warning(this, "Clear ROI",
|
||||
"Are you sure you want to clear all the ROI in detector?",
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes){
|
||||
|
||||
clearROI();
|
||||
setROI();
|
||||
#ifdef VERBOSE
|
||||
cout << "ROIs cleared" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabAdvanced::Refresh(){
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << endl << "**Updating Advanced Tab" << endl;
|
||||
#endif
|
||||
@ -744,7 +955,6 @@ void qTabAdvanced::Refresh(){
|
||||
|
||||
if(detType==slsDetectorDefs::GOTTHARD){
|
||||
//disconnect
|
||||
disconnect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int)));
|
||||
disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
|
||||
disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
|
||||
disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
|
||||
@ -770,7 +980,6 @@ void qTabAdvanced::Refresh(){
|
||||
dispUDPMAC->setText(QString(myDet->getNetworkParameter(slsDetectorDefs::RECEIVER_UDP_MAC)));
|
||||
|
||||
//connect
|
||||
connect(comboADC, SIGNAL(currentIndexChanged(int)), this, SLOT(SetADCReadout(int)));
|
||||
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
|
||||
connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
|
||||
connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
|
||||
@ -810,6 +1019,8 @@ void qTabAdvanced::Refresh(){
|
||||
}
|
||||
|
||||
|
||||
//roi
|
||||
updateROIList();
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
|
@ -39,7 +39,9 @@ void qTabSettings::SetupWidgetWindow(){
|
||||
|
||||
// Settings
|
||||
SetupDetectorSettings();
|
||||
comboSettings->setCurrentIndex(myDet->getSettings());
|
||||
int sett = (int)myDet->getSettings();
|
||||
if(sett==-1) sett = slsDetectorDefs::UNDEFINED;
|
||||
comboSettings->setCurrentIndex(sett);
|
||||
|
||||
//threshold
|
||||
spinThreshold->setValue(myDet->getThresholdEnergy());
|
||||
@ -69,6 +71,7 @@ void qTabSettings::SetupWidgetWindow(){
|
||||
void qTabSettings::SetupDetectorSettings(){
|
||||
// Get detector settings from detector
|
||||
slsDetectorDefs::detectorSettings sett = myDet->getSettings();
|
||||
if(sett==-1) sett = slsDetectorDefs::UNDEFINED;
|
||||
// To be able to index items on a combo box
|
||||
model = qobject_cast<QStandardItemModel*>(comboSettings->model());
|
||||
if (model) {
|
||||
@ -145,7 +148,9 @@ void qTabSettings::setSettings(int index){
|
||||
if((index==Undefined)||(index==Uninitialized)){
|
||||
qDefs::Message(qDefs::WARNING,"Cannot change settings to Undefined or Uninitialized.","Settings");
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
comboSettings->setCurrentIndex((int)myDet->getSettings());
|
||||
int sett = (int)myDet->getSettings();
|
||||
if(sett==-1) sett = slsDetectorDefs::UNDEFINED;
|
||||
comboSettings->setCurrentIndex(sett);
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
}
|
||||
|
||||
@ -268,12 +273,14 @@ void qTabSettings::Refresh(){
|
||||
cout << "Getting settings" << endl;
|
||||
#endif
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
comboSettings->setCurrentIndex((int)myDet->getSettings());
|
||||
int sett = (int)myDet->getSettings();
|
||||
if(sett==-1) sett = slsDetectorDefs::UNDEFINED;
|
||||
comboSettings->setCurrentIndex(sett);
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
|
||||
|
||||
//threshold
|
||||
int sett = comboSettings->currentIndex();
|
||||
sett = comboSettings->currentIndex();
|
||||
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){
|
||||
if((sett==Undefined)||(sett==Uninitialized)){
|
||||
lblThreshold->setEnabled(false);
|
||||
|
Reference in New Issue
Block a user