From d84f95456b30e4a6ed753ab80fa9db29d3673776 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 17 Jul 2013 14:54:42 +0000 Subject: [PATCH] included accumulate, pedestal and binary git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@204 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_plot.ui | 939 +++++++++++++++++--------- slsDetectorGui/include/qDrawPlot.h | 38 +- slsDetectorGui/include/qTabPlot.h | 10 +- slsDetectorGui/src/qDrawPlot.cpp | 186 +++-- slsDetectorGui/src/qTabPlot.cpp | 185 +++-- 5 files changed, 922 insertions(+), 436 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui index dc515bac4..3c0bb4aae 100644 --- a/slsDetectorGui/forms/form_tab_plot.ui +++ b/slsDetectorGui/forms/form_tab_plot.ui @@ -99,50 +99,15 @@ - 0 + 3 - - - - 345 - 0 - 16 - 16 - - - - - 0 - 0 - - - - Qt::NoFocus - - - - - - - :/icons/images/rightArrow.png:/icons/images/rightArrow.png - - - - 16 - 16 - - - - true - - - 5 + 20 5 - 341 + 327 26 @@ -196,7 +161,7 @@ - 29 + 15 20 @@ -212,7 +177,7 @@ - 29 + 20 20 @@ -221,49 +186,45 @@ - - + + - 345 - 0 - 16 - 16 + 25 + 5 + 95 + 26 - - - 0 - 0 - - - - Qt::NoFocus - - - - - - - :/icons/images/rightArrow.png:/icons/images/rightArrow.png - - - - 16 - 16 - - - - true - + + + 0 + + + + + true + + + + 0 + 0 + + + + Accumulate + + + + - + - 5 - 4 - 141 - 25 + 175 + 3 + 156 + 26 @@ -319,82 +280,7 @@ Qt::NoFocus - Reset Pedestal - - - - :/icons/images/erase.png:/icons/images/erase.png - - - - 16 - 16 - - - - - - - 200 - 4 - 141 - 25 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 20 - 20 - 20 - - - - - - - - - 20 - 20 - 20 - - - - - - - - - 20 - 20 - 20 - - - - - - - - Qt::NoFocus - - - Calculate Pedestal + Reset Accumulation @@ -408,6 +294,257 @@ + + + + + 20 + 5 + 76 + 26 + + + + + 0 + + + + + true + + + + 0 + 0 + + + + Pedestal + + + + + + + + + 160 + 3 + 171 + 26 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + Qt::NoFocus + + + Recalculate Pedestal + + + + :/icons/images/calculate.png:/icons/images/calculate.png + + + + 16 + 16 + + + + horizontalLayoutWidget_5 + btnSave_2 + btnRecalPedestal_2 + + + + + + 25 + 5 + 311 + 26 + + + + + 1 + + + + + + 0 + 0 + + + + Binary + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + + 0 + 0 + + + + from + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + + + + false + + + + 0 + 0 + + + + to + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + + + @@ -438,13 +575,13 @@ - 0 + 4 - 5 + 25 5 107 26 @@ -531,49 +668,14 @@ - - - - 345 - 0 - 16 - 16 - - - - - 0 - 0 - - - - Qt::NoFocus - - - - - - - :/icons/images/rightArrow.png:/icons/images/rightArrow.png - - - - 16 - 16 - - - - true - - - 5 + 25 5 - 336 + 321 26 @@ -644,50 +746,15 @@ - - - - 345 - 0 - 16 - 16 - - - - - 0 - 0 - - - - Qt::NoFocus - - - - - - - :/icons/images/rightArrow.png:/icons/images/rightArrow.png - - - - 16 - 16 - - - - true - - - - + + - 5 - 5 - 141 - 25 + 175 + 3 + 161 + 26 @@ -743,82 +810,7 @@ Qt::NoFocus - Reset Pedestal - - - - :/icons/images/erase.png:/icons/images/erase.png - - - - 16 - 16 - - - - - - - 200 - 5 - 141 - 25 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 20 - 20 - 20 - - - - - - - - - 20 - 20 - 20 - - - - - - - - - 20 - 20 - 20 - - - - - - - - Qt::NoFocus - - - Calculate Pedestal + Reset Accumulation @@ -831,13 +823,77 @@ - + - 345 - 0 - 16 - 16 + 25 + 5 + 95 + 26 + + + + + 0 + + + + + true + + + + 0 + 0 + + + + Accumulate + + + + + + + + + + + 25 + 5 + 76 + 26 + + + + + 0 + + + + + true + + + + 0 + 0 + + + + Pedestal + + + + + + + + + 165 + 3 + 171 + 26 @@ -846,15 +902,58 @@ 0 + + + 16777215 + 16777215 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + + + + 20 + 20 + 20 + + + + + + Qt::NoFocus - + Recalculate Pedestal - :/icons/images/rightArrow.png:/icons/images/rightArrow.png + :/icons/images/calculate.png:/icons/images/calculate.png @@ -862,9 +961,140 @@ 16 - - true + + + + + + + 25 + 5 + 311 + 26 + + + + 1 + + + + + Binary + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + + 0 + 0 + + + + from + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + + + + false + + + + 0 + 0 + + + + to + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 0 + + + 16777215 + + + 0 + + + + @@ -993,9 +1223,6 @@ - horizontalLayoutWidget - btnSave - gridLayoutWidget_5 @@ -2044,8 +2271,76 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo - gridLayoutWidget_4 - gridLayoutWidget_5 + + + + + 362 + 95 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/rightArrow.png:/icons/images/rightArrow.png + + + + 16 + 16 + + + + true + + + + + + 23 + 94 + 16 + 16 + + + + + 0 + 0 + + + + Qt::NoFocus + + + + + + + :/icons/images/leftArrow.png:/icons/images/leftArrow.png + + + + 16 + 16 + + + + true + diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 09894f69a..448d4bdca 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -131,6 +131,9 @@ public: */ void UpdateAfterCloning(bool points, bool logy, bool interpolate, bool contour, bool logz); + /** set binary range */ + void SetBinary(bool enable, int from=0, int to=0); + public slots: /** To select 1D or 2D plot @param i is 1 for 1D, else 2D plot */ @@ -161,14 +164,14 @@ void SetMarkers(bool enable){markers = enable;}; void SetScanArgument(int scanArg); /** sets stop_signal to true */ void StopAcquisition(){ stop_signal = true; }; - - -//pedestal -/** reset pedestal */ -void ResetPedestal(); -/** Calculate Pedestal */ -void CalculatePedestal(); - +/** Set/unset pedestal */ +void SetPedestal(bool enable); +/** Recalculate Pedestal */ +void RecalculatePedestal(); +/** Set/unset accumulate */ +void SetAccumulate(bool enable); +/** Reset accumulation */ +void ResetAccumulate(); private: @@ -491,12 +494,27 @@ bool originally2D; //pedstal /** Number of pedestal frames*/ static const int NUM_PEDESTAL_FRAMES = 20; -/**reset pedestal*/ -bool resetPedestal; +/** set/unset pedestal*/ +bool pedestal; /** pedestal values */ double* pedestalVals; +/** temporary pedestal values to hide while recalculating*/ +double* tempPedestalVals; /** count for 20 frames to calculate the pedestal */ int pedestalCount; +/** start pedestal calculation */ +bool startPedestalCal; + +//accumulation +/** set/unset accumulation */ +bool accumulate; +/** to reset accumulation */ +bool resetAccumulate; + +/** range for binary plot output */ +bool binary; +int binaryFrom; +int binaryTo; /** this is set when client starts/stops acquisition * and is reset once the gui really starts/stops */ diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 0dbda9cd0..08390742f 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -147,12 +147,14 @@ private slots: /** Set Plot to none, data graph, histogram*/ void SetPlot(); - /** Change pages in 1D box*/ - void Set1DPage(); + /** Change pages in plot options box to the right*/ + void SetPlotOptionsRightPage(); - /** Change pages in 2D box*/ - void Set2DPage(); + /** Change pages in plot options box to the left*/ + void SetPlotOptionsLeftPage(); + /** Plot binary plot */ + void SetBinary(); signals: void DisableZoomSignal(bool); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 99b6626e9..1f0f1af2c 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -179,15 +179,23 @@ void qDrawPlot::SetupWidgetWindow(){ fileSaveEnable= myDet->enableWriteToFile(); //pedestal - resetPedestal = true; + pedestal = false; pedestalVals = 0; - pedestalCount = -1; + tempPedestalVals = 0; + pedestalCount = 0; + startPedestalCal = false; - if(myDet->getDetectorsType()==slsDetectorDefs::GOTTHARD) - pedestalCount = 0; + //accumulate + accumulate = false; + resetAccumulate = false; clientInitiated = false; + //binary plot output + binary = false; + binaryFrom = 0; + binaryTo = 0; + //widget related initialization // clone @@ -854,70 +862,95 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){ for(int i=currentPersistency;i>0;i--) memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double)); - //normal data - if(resetPedestal){ - memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); - }else{ + //recalculating pedestal + if(startPedestalCal){ + pedestalCount++; //start adding frames to get to the pedestal value if(pedestalCountvalues[px]; + tempPedestalVals[px] += data->values[px]; memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); } //calculate the pedestal value else if(pedestalCount==NUM_PEDESTAL_FRAMES){ cout << "Pedestal Calculated" << endl; for(unsigned int px=0;pxvalues,nPixelsX*sizeof(double)); + tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; + memcpy(pedestalVals,tempPedestalVals,nPixelsX*sizeof(double)); + startPedestalCal = 0; } - //use this pedestal value henceforth - else{ - for(unsigned int px=0;pxvalues[px] - (pedestalVals[px]); - } - pedestalCount++; - } + //normal data + if(((!pedestal)&(!accumulate)) || (resetAccumulate)){ + memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double)); + resetAccumulate = false; + } + //pedestal or accumulate + else{ + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ + if(accumulate) + histYAxis[0][px] += data->values[px]; + else + histYAxis[0][px] = data->values[px]; + if(pedestal) + histYAxis[0][px] = histYAxis[0][px] - (pedestalVals[px]); + if(binary) { + if ((histYAxis[0][px] >= binaryFrom) && (histYAxis[0][px] <= binaryTo)) + histYAxis[0][px] = 1; + else + histYAxis[0][px] = 0; + } + } + } } //2d else{ // Titles imageTitle = temp_title; - // manufacture data for now - /* default data - for(unsigned int px=0;pxvalues,nPixelsX*nPixelsY*sizeof(double));*/ - //normal data - if(resetPedestal){ - memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); - }else{ + //recalculating pedestal + if(startPedestalCal){ + pedestalCount++; //start adding frames to get to the pedestal value if(pedestalCountvalues[px]; + tempPedestalVals[px] += data->values[px]; memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); } //calculate the pedestal value else if(pedestalCount==NUM_PEDESTAL_FRAMES){ cout << "Pedestal Calculated" << endl; for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) - pedestalVals[px] = pedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; - memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); - } - //use this pedestal value henceforth - else{ - for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) - lastImageArray[px] = data->values[px] - (pedestalVals[px]); - } - pedestalCount++; + tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; + memcpy(pedestalVals,tempPedestalVals,nPixelsX*nPixelsY*sizeof(double)); + startPedestalCal = 0; + } } + + //normal data + if(((!pedestal)&(!accumulate)) || (resetAccumulate)){ + memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); + resetAccumulate = false; + } + //pedestal or accumulate or binary + else{ + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ + if(accumulate) + lastImageArray[px] += data->values[px]; + else + lastImageArray[px] = data->values[px]; + if(pedestal) + lastImageArray[px] = lastImageArray[px] - (pedestalVals[px]); + if(binary) { + if ((lastImageArray[px] >= binaryFrom) && (lastImageArray[px] <= binaryTo)) + lastImageArray[px] = 1; + else + lastImageArray[px] = 0; + } + } + } + } pthread_mutex_unlock(&(last_image_complete_mutex)); } @@ -1591,15 +1624,41 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::ResetPedestal(){ +void qDrawPlot::SetPedestal(bool enable){ #ifdef VERBOSE - cout << "Resetting Pedestal" << endl; + cout << "Setting Pedestal to " << enable << endl; +#endif + if(enable){ + pedestal = true; + if(pedestalVals == 0) + RecalculatePedestal(); + }else{ + pedestal = false; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::RecalculatePedestal(){ +#ifdef VERBOSE + cout << "Recalculating Pedestal" << endl; #endif while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - pedestalVals = 0; + startPedestalCal = 1; pedestalCount = 0; - resetPedestal = true; + + //create array + if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX*nPixelsY]; + if(tempPedestalVals) delete [] tempPedestalVals; tempPedestalVals = new double[nPixelsX*nPixelsY]; + //reset all values + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) + pedestalVals[px] = 0; + for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) + tempPedestalVals[px] = 0; + pthread_mutex_unlock(&(last_image_complete_mutex)); break; } @@ -1610,20 +1669,23 @@ void qDrawPlot::ResetPedestal(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::CalculatePedestal(){ +void qDrawPlot::SetAccumulate(bool enable){ #ifdef VERBOSE - cout << "Calculating Pedestal" << endl; + cout << "Setting Accumulate to " << enable << endl; +#endif + accumulate = enable; +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qDrawPlot::ResetAccumulate(){ +#ifdef VERBOSE + cout << "Resetting Accumulation" << endl; #endif while(1){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ - //create array - if(pedestalVals) delete [] pedestalVals; pedestalVals = new double[nPixelsX*nPixelsY]; - //reset all values - for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) - pedestalVals[px] = 0; - - pedestalCount = 0; - resetPedestal = false; + resetAccumulate = true; pthread_mutex_unlock(&(last_image_complete_mutex)); break; } @@ -1672,3 +1734,19 @@ void qDrawPlot::UpdateAfterCloning(bool points, bool logy, bool interpolate, boo //------------------------------------------------------------------------------------------------------------------------------------------------- +void qDrawPlot::SetBinary(bool enable, int from, int to){ +#ifdef VERBOSE + if(!enable) + cout << "Disabling Binary output " << endl; + else + cout << "Enabling Binary output from " << from << " to " << to << endl; +#endif + binary = enable; + binaryFrom = from; + binaryTo = to; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 2592be6cb..e8343d9d4 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -139,13 +139,37 @@ void qTabPlot::SetupWidgetWindow(){ stackedLayout->addWidget(spinNthFrame); stackWidget->setLayout(stackedLayout); + stackedWidget->setCurrentIndex(0); + stackedWidget_2->setCurrentIndex(0); // Depending on whether the detector is 1d or 2d switch(myDet->getDetectorsType()){ - case slsDetectorDefs::MYTHEN: isOriginallyOneD = true; break; - case slsDetectorDefs::EIGER: isOriginallyOneD = false; break; - case slsDetectorDefs::GOTTHARD: isOriginallyOneD = true; break; - case slsDetectorDefs::MOENCH: isOriginallyOneD = false; break; + case slsDetectorDefs::MYTHEN: + isOriginallyOneD = true; + chkPedestal->setEnabled(false); + btnRecalPedestal->setEnabled(false); + layoutThreshold->setEnabled(false); + chkPedestal_2->setEnabled(false); + btnRecalPedestal_2->setEnabled(false); + chkBinary->setEnabled(false); + chkBinary_2->setEnabled(false); + break; + case slsDetectorDefs::EIGER: + isOriginallyOneD = false; + chkPedestal->setEnabled(false); + btnRecalPedestal->setEnabled(false); + layoutThreshold->setEnabled(false); + chkPedestal_2->setEnabled(false); + btnRecalPedestal_2->setEnabled(false); + chkBinary->setEnabled(false); + chkBinary_2->setEnabled(false); + break; + case slsDetectorDefs::GOTTHARD: + isOriginallyOneD = true; + break; + case slsDetectorDefs::MOENCH: + isOriginallyOneD = false; + break; default: cout << "ERROR: Detector Type is Generic" << endl; exit(-1); @@ -158,17 +182,6 @@ void qTabPlot::SetupWidgetWindow(){ //to check if this should be enabled EnableScanBox(); - stackedWidget->setCurrentIndex(0); - stackedWidget_2->setCurrentIndex(0); - if(myDet->getDetectorsType()!=slsDetectorDefs::GOTTHARD){ - btnCalPedestal->setEnabled(false); - btnResetPedestal->setEnabled(false); - } - if(myDet->getDetectorsType()!=slsDetectorDefs::MOENCH){ - btnCalPedestal_2->setEnabled(false); - btnResetPedestal_2->setEnabled(false); - } - qDefs::checkErrorMessage(myDet); } @@ -176,36 +189,44 @@ void qTabPlot::SetupWidgetWindow(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::Set2DPage(){ - //QPushButton *clickedButton = qobject_cast(sender()); - if(stackedWidget_2->currentIndex()==0){ - stackedWidget_2->setCurrentIndex(1); - box2D->setTitle("2D Plot Options 2"); +void qTabPlot::SetPlotOptionsRightPage(){ + if(isOneD){ + int i = stackedWidget->currentIndex(); + if(i == (stackedWidget->count()-1)) + stackedWidget->setCurrentIndex(0); + else + stackedWidget->setCurrentIndex(i+1); + box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex()+1)); } else{ - stackedWidget_2->setCurrentIndex(0); - box2D->setTitle("2D Plot Options 1"); + int i = stackedWidget_2->currentIndex(); + if(i == (stackedWidget_2->count()-1)) + stackedWidget_2->setCurrentIndex(0); + else + stackedWidget_2->setCurrentIndex(i+1); + box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex()+1)); } } - //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabPlot::Set1DPage(){ - //QPushButton *clickedButton = qobject_cast(sender()); - if(stackedWidget->currentIndex()==0){ - //if(clickedButton->icon().pixmap(QSize(16,16)).toImage()==btnLeft->icon().pixmap(QSize(16,16)).toImage()) - stackedWidget->setCurrentIndex(1); - box1D->setTitle("1D Plot Options 2"); - } - else if(stackedWidget->currentIndex()==1){ - stackedWidget->setCurrentIndex(2); - box1D->setTitle("1D Plot Options 3"); +void qTabPlot::SetPlotOptionsLeftPage(){ + if(isOneD){ + int i = stackedWidget->currentIndex(); + if(i == 0) + stackedWidget->setCurrentIndex(stackedWidget->count()-1); + else + stackedWidget->setCurrentIndex(i-1); + box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex()+1)); } else{ - stackedWidget->setCurrentIndex(0); - box1D->setTitle("1D Plot Options 1"); + int i = stackedWidget_2->currentIndex(); + if(i == 0) + stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1); + else + stackedWidget_2->setCurrentIndex(i-1); + box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex()+1)); } } @@ -215,6 +236,14 @@ void qTabPlot::Set1DPage(){ void qTabPlot::Select1DPlot(bool b){ isOneD = b; + lblFrom->setEnabled(false); + lblTo->setEnabled(false); + lblFrom_2->setEnabled(false); + lblTo_2->setEnabled(false); + spinFrom->setEnabled(false); + spinFrom_2->setEnabled(false); + spinTo->setEnabled(false); + spinTo_2->setEnabled(false); if(b){ box1D->show(); box2D->hide(); @@ -247,22 +276,20 @@ void qTabPlot::Initialization(){ connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones())); connect(btnSaveClones, SIGNAL(clicked()),myPlot, SLOT(SaveClones())); // 1D Plot box + //to change pages + connect(btnRight, SIGNAL(clicked()), this, SLOT(SetPlotOptionsRightPage())); + connect(btnLeft, SIGNAL(clicked()), this, SLOT(SetPlotOptionsLeftPage())); + connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool))); connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int))); connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool))); connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool))); connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogySignal(bool))); - //to change pages - connect(btnRight, SIGNAL(clicked()), this, SLOT(Set1DPage())); - connect(btnRight2, SIGNAL(clicked()), this, SLOT(Set1DPage())); - connect(btnRight3, SIGNAL(clicked()), this, SLOT(Set1DPage())); + // 2D Plot box connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool))); connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool))); connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool))); - //to change pages - connect(btn2DRight, SIGNAL(clicked()), this, SLOT(Set2DPage())); - connect(btn2DRight2, SIGNAL(clicked()), this, SLOT(Set2DPage())); // Plotting frequency box connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); @@ -299,11 +326,24 @@ void qTabPlot::Initialization(){ connect(this,SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double))); //pedstal - connect(btnResetPedestal, SIGNAL(clicked()),myPlot, SLOT(ResetPedestal())); - connect(btnCalPedestal, SIGNAL(clicked()),myPlot, SLOT(CalculatePedestal())); - connect(btnResetPedestal_2, SIGNAL(clicked()),myPlot, SLOT(ResetPedestal())); - connect(btnCalPedestal_2, SIGNAL(clicked()),myPlot, SLOT(CalculatePedestal())); + connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool))); + connect(btnRecalPedestal, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal())); + connect(chkPedestal_2, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool))); + connect(btnRecalPedestal_2, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal())); +//accumulate + connect(chkAccumulate, SIGNAL(toggled(bool)), myPlot, SLOT(SetAccumulate(bool))); + connect(btnResetAccumulate, SIGNAL(clicked()), myPlot, SLOT(ResetAccumulate())); + connect(chkAccumulate_2, SIGNAL(toggled(bool)), myPlot, SLOT(SetAccumulate(bool))); + connect(btnResetAccumulate_2, SIGNAL(clicked()), myPlot, SLOT(ResetAccumulate())); + + //binary + connect(chkBinary, SIGNAL(toggled(bool)), this, SLOT(SetBinary())); + connect(chkBinary_2, SIGNAL(toggled(bool)), this, SLOT(SetBinary())); + connect(spinFrom, SIGNAL(valueChanged(int)), this, SLOT(SetBinary())); + connect(spinFrom_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary())); + connect(spinTo, SIGNAL(valueChanged(int)), this, SLOT(SetBinary())); + connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary())); } @@ -906,4 +946,57 @@ void qTabPlot::UpdateAfterCloning(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabPlot::SetBinary(){ + //1d + if(isOneD){ + if(chkBinary->isChecked()){ +#ifdef VERBOSE + cout << endl << "Enabling Binary" << endl; +#endif + lblFrom->setEnabled(true); + lblTo->setEnabled(true); + spinFrom->setEnabled(true); + spinTo->setEnabled(true); + myPlot->SetBinary(true,spinFrom->value(),spinTo->value()); + }else{ +#ifdef VERBOSE + cout << endl << "Disabling Binary" << endl; +#endif + lblFrom->setEnabled(false); + lblTo->setEnabled(false); + spinFrom->setEnabled(false); + spinTo->setEnabled(false); + myPlot->SetBinary(false); + } + } + //2d + else{ + if(chkBinary_2->isChecked()){ +#ifdef VERBOSE + cout << endl << "Enabling Binary" << endl; +#endif + lblFrom_2->setEnabled(true); + lblTo_2->setEnabled(true); + spinFrom_2->setEnabled(true); + spinTo_2->setEnabled(true); + myPlot->SetBinary(true,spinFrom_2->value(),spinTo_2->value()); + + }else{ +#ifdef VERBOSE + cout << endl << "Disabling Binary" << endl; +#endif + + lblFrom_2->setEnabled(false); + lblTo_2->setEnabled(false); + spinFrom_2->setEnabled(false); + spinTo_2->setEnabled(false); + myPlot->SetBinary(false); + } + } +} + + //-------------------------------------------------------------------------------------------------------------------------------------------------