diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui
index 30075ae9b..a78e1c4ea 100644
--- a/slsDetectorGui/forms/form_tab_advanced.ui
+++ b/slsDetectorGui/forms/form_tab_advanced.ui
@@ -6,8 +6,8 @@
0
0
- 748
- 339
+ 775
+ 345
@@ -31,18 +31,344 @@
Form
-
+
- 69
- 229
- 75
- 25
+ 25
+ 83
+ 740
+ 93
-
- PushButton
+
+ Files:
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 5
+
+
+ -1
+
+
+ 9
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Trimbit File:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Load
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Save
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 120
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Calibration File:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Load
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Save
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Output File:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ -
+
+
+ Browse
+
+
+
+
+
+
+
+
+
+
+ 25
+ 200
+ 726
+ 58
+
+
+
+ Trimming Method
+
+
+
+
+ 10
+ 20
+ 711
+ 31
+
+
+
+
+ 15
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ None
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Adjust to Fix Count Level
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Equalize to Median
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Optimize Settings
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Offline Improvement
+
+
+
+
+
+
+
+
+
+ 25
+ 20
+ 726
+ 58
+
+
+
+ Calibration Logs
+
+
+
+
+ 35
+ 20
+ 626
+ 31
+
+
+
+
+ 15
+
+ -
+
+
+ Energy Calibration
+
+
+
+ -
+
+
+ Angular Calibration
+
+
+
+
+
+ horizontalLayoutWidget_2
+ checkBox_3
diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui
index aeca75ca8..4e02206dc 100644
--- a/slsDetectorGui/forms/form_tab_debugging.ui
+++ b/slsDetectorGui/forms/form_tab_debugging.ui
@@ -34,9 +34,9 @@
- 265
- 30
- 251
+ 30
+ 50
+ 321
36
@@ -75,7 +75,7 @@
30
- 165
+ 140
321
156
@@ -126,9 +126,9 @@
- 265
- 95
- 251
+ 425
+ 55
+ 316
25
@@ -140,7 +140,7 @@
425
- 165
+ 140
321
156
diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui
index 569816ca4..56a301af5 100644
--- a/slsDetectorGui/forms/form_tab_plot.ui
+++ b/slsDetectorGui/forms/form_tab_plot.ui
@@ -487,13 +487,13 @@
- Scan - Y Axis Values
+ 2D Scan - Y Axis Values
- false
+ true
- false
+ true
@@ -1443,7 +1443,7 @@
-
-
+
true
diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h
index 0fe0def05..8316989f3 100644
--- a/slsDetectorGui/include/qCloneWidget.h
+++ b/slsDetectorGui/include/qCloneWidget.h
@@ -65,6 +65,11 @@ public:
* */
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]);
+public slots:
+/** Save Plots automatically by save all clones
+ * returns -1 if fail*/
+int SavePlotAutomatic();
+
private:
/** clone window id*/
diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h
index e269a1bd4..f0e578f65 100644
--- a/slsDetectorGui/include/qDrawPlot.h
+++ b/slsDetectorGui/include/qDrawPlot.h
@@ -27,6 +27,7 @@ class qCloneWidget;
/** C++ Include Headers */
+
#define MAX_1DPLOTS 10
@@ -120,8 +121,12 @@ void Clear1DPlot();
void ClonePlot();
/** Closes all the clone plots */
void CloseClones();
+/** Saves all the clone plots */
+void SaveClones();
/** To Save plot */
void SavePlot();
+/** Save all plots **/
+void SaveAll(bool enable);
/** Sets persistency from plot tab */
void SetPersistency(int val);
/** sets style of plot to dotted */
@@ -168,9 +173,8 @@ static void* DataStartAcquireThread(void *this_pointer);
static int GetDataCallBack(detectorData *data, void *this_pointer);
/** This is called by the GetDataCallBack function to copy the data */
int GetData(detectorData *data);
-
-
-
+/** Saves all the plots. All sets saveError to true if not saved.*/
+void SavePlotAutomatic();
@@ -187,9 +191,12 @@ void StartDaq(bool start);
/** To set the reference to zero after closing a clone
* @param id is the id of the clone */
void CloneCloseEvent(int id);
-
+/**After a pause, the gui is allowed to collect the data
+ * this is called when it is over */
void UpdatePause(){data_pause_over=true;};
-
+/** Shows the first save error message while automatic saving
+ * @param fileName file name of the first file that it tried to save.*/
+void ShowSaveErrorMessage(QString fileName);
@@ -233,14 +240,21 @@ int currentMeasurement;
int currentFrame;
/** current Index */
int currentIndex;
+/** current Scan Division Level */
+int currentScanDivLevel;
+/** current scan Value */
+double currentScanValue;
/** Number of Exposures */
int number_of_exposures;
+/** Number of Frames Per Measurement */
+int number_of_frames;
/** Duration between Exposures */
double acquisitionPeriod;
/** Acquisition Time */
double exposureTime;
+
/**variables for threads */
/** */
volatile bool stop_signal;
@@ -266,8 +280,19 @@ std::string imageTitle;
unsigned int plot_in_scope;
/** Number of Pixels in X Axis */
unsigned int nPixelsX;
-/** Number of Pixels in Y Axis */
-unsigned int nPixelsY;
+/** Number of pixel bins in Y Axis */
+int nPixelsY;
+/** Min Pixel number for Y Axis*/
+double minPixelsY;
+/** Max Pixel number for Y Axis*/
+double maxPixelsY;
+/** starting pixel */
+double startPixel;
+/** end Pixel*/
+double endPixel;
+/** pixel width */
+double pixelWidth;
+
/** Current Image Number */
unsigned int lastImageNumber;
int last_plot_number;
@@ -299,8 +324,14 @@ int progress;
bool plotEnable;
/**If plot is dotted */
bool plotDotted;
-
-
+/** Save all plots */
+bool saveAll;
+/** If error, while automatically saving plots, checks this at the end of an acquistion */
+bool saveError;
+/** index of last saved image for automatic saving*/
+int lastSavedFrame;
+/** index of measurement number of last saved image for automatic saving*/
+int lastSavedMeasurement;
/**if an acquisition is running, so as not to refresh tab
* and also to update plot only if running (while creating clones)*/
bool running;
@@ -319,9 +350,6 @@ static const double PLOT_TIMER_MS = 250;
double timerValue;
/** every nth frame when to plot */
int frameFactor;
-/** old data that did not get lock(for frame factor)**/
-bool oldCopy;
-int oldFrameNumber;
/**if frame is enabled in measurement tab */
bool isFrameEnabled;
/**if trigger is enabled in measurement tab */
@@ -341,6 +369,7 @@ void LogzSignal(bool);
void SetZRangeSignal(double,double);
void EnableZRangeSignal(bool);
void SetCurrentMeasurementSignal(int);
+void saveErrorSignal(QString);
};
diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h
index 0b7598ec6..bb7fb2fa9 100644
--- a/slsDetectorGui/include/qScanWidget.h
+++ b/slsDetectorGui/include/qScanWidget.h
@@ -145,7 +145,7 @@ void BrowseFileStepsPath();
signals:
-void EnableScanBox(int,int);
+void EnableScanBox();
};
diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h
index a10b033ad..aaa16951c 100644
--- a/slsDetectorGui/include/qTabActions.h
+++ b/slsDetectorGui/include/qTabActions.h
@@ -12,9 +12,9 @@
/* Qt Project Class Headers */
#include "qActionsWidget.h"
#include "qScanWidget.h"
-/** Project Class Headers */
+/** C++ Project Class Headers */
class multiSlsDetector;
-class qActionsWidget;
+#include "sls_detector_defs.h"
/** Qt Include Headers */
#include
#include
@@ -48,11 +48,19 @@ public:
*/
void Refresh();
+public slots:
+/** Disable Positions
+ * @param enable true if to disable
+ * */
+void EnablePositions(bool enable);
+
private:
/** The sls detector object */
multiSlsDetector *myDet;
+ slsDetectorDefs::detectorType detType;
+
enum actionIndex{Scan0=1, Scan1, NumPositions=4, NumTotalActions=9};
QGridLayout *gridLayout;
@@ -111,7 +119,7 @@ void SetPosition();
void DeletePosition();
signals:
-void EnableScanBox(int,int);
+void EnableScanBox();
};
diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h
index f2c9b7edb..a0c3cb1f4 100644
--- a/slsDetectorGui/include/qTabDataOutput.h
+++ b/slsDetectorGui/include/qTabDataOutput.h
@@ -92,6 +92,10 @@ void SetAngularCorrection();
/**discard bad channels*/
void DiscardBadChannels();
+
+signals:
+/**signal to enable/disable positions in Actions*/
+void AngularConversionSignal(bool);
};
diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h
index 0d75a9d76..2187a6a99 100644
--- a/slsDetectorGui/include/qTabPlot.h
+++ b/slsDetectorGui/include/qTabPlot.h
@@ -97,10 +97,8 @@ public slots:
/** Set frequency between plots*/
void SetFrequency();
/** Enable Scan box
- * @param enable to enable the scan group box
- * @param id is 0 if its scan level 0 or scan level 1
*/
-void EnableScanBox(int mode=-1,int id=-1);
+void EnableScanBox();
/** a variable is set when timing mode has been changed.
* This variable is also disabled if exptime>acq period to be on safe side
diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h
index 4404368a0..77d867180 100644
--- a/slsDetectorGui/include/qTabSettings.h
+++ b/slsDetectorGui/include/qTabSettings.h
@@ -38,12 +38,6 @@ public:
*/
void Refresh();
- /** enable expert mode
- * @param enable true if expert mode is enabled
- */
- void EnableExpertMode(bool enable){expertMode=enable;Refresh();};
-
-
private:
/** The sls detector object */
@@ -55,7 +49,7 @@ private:
/** detector type */
slsDetectorDefs::detectorType detType;
- bool expertMode;
+
enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings};
diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp
index c0345813b..606138be5 100644
--- a/slsDetectorGui/src/qCloneWidget.cpp
+++ b/slsDetectorGui/src/qCloneWidget.cpp
@@ -66,7 +66,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot
cloneBox->setContentsMargins(0,0,0,0);
cloneBox->setTitle(title);
cloneBox->setAlignment(Qt::AlignHCenter);
- cloneBox->setFont(QFont("Sans Serif",11,QFont::Bold));
+ cloneBox->setFont(QFont("Sans Serif",11,QFont::Normal));
/** According to dimensions, create appropriate 1D or 2Dplot */
if(numDim==1){
cloneplot1D = plot1D;
@@ -82,49 +82,6 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot
cloneBox->setContentsMargins(0,5,0,0);
}
- /** Save group box */
-/*
- boxSave = new QGroupBox("Save Image",this);
- boxSave->setFixedHeight(45);
- boxSave->setContentsMargins(0,8,0,0);
- layoutSave = new QHBoxLayout;
- boxSave->setLayout(layoutSave);
- * Label file name
- lblFName = new QLabel("File Name:",this);
- layoutSave->addWidget(lblFName);
- * To get 0 spacing between the next 2 widgets file name and file format
- hLayoutSave = new QHBoxLayout();
- layoutSave->addLayout(hLayoutSave);
- hLayoutSave->setSpacing(0);
- * file name
- dispFName = new QLineEdit(this);
- dispFName->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
- hLayoutSave->addWidget(dispFName);
- * file format
- comboFormat = new QComboBox(this);
- comboFormat->setFrame(true);
- comboFormat->addItem(".gif");
- comboFormat->addItem(".pdf");
- comboFormat->addItem(".png");
- comboFormat->addItem(".gif+");
- comboFormat->addItem(".jpg");
- comboFormat->addItem(".ps");
- comboFormat->addItem(".eps");
- comboFormat->addItem(".xpm");
- comboFormat->addItem(".C");
- hLayoutSave->addWidget(comboFormat);
- * save button
- btnSave = new QPushButton("Save",this);
- btnSave->setFocusPolicy(Qt::NoFocus);
- layoutSave->addWidget(btnSave);
- * automatic file name check box
- chkAutoFName = new QCheckBox("Automatic File Name",this);
- layoutSave->addWidget(chkAutoFName);
- * automatic save all check box
- chkSaveAll = new QCheckBox("Save All",this);
- layoutSave->addWidget(chkSaveAll);
-*/
-
/** main window widgets */
//mainLayout->addWidget(boxSave,0,0);
mainLayout->addWidget(cloneBox,1,0);
@@ -192,6 +149,22 @@ void qCloneWidget::SavePlot(){
"Formats: .png, .jpg, .xpm.","Snapshot");
}
+
+//-------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+int qCloneWidget::SavePlotAutomatic(){
+ char cID[10];
+ sprintf(cID,"%d",id);
+ QString fName = QString(filePath.c_str())+"/Snapshot_"+QString(cID)+".png";
+ QImage img(cloneBox->size().width(),cloneBox->size().height(),QImage::Format_RGB32);
+ QPainter painter(&img);
+ cloneBox->render(&painter);
+ if(img.save(fName))
+ return 0;
+ else return -1;
+
+}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qCloneWidget::closeEvent(QCloseEvent* event){
diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp
index 3427df528..98723fe25 100644
--- a/slsDetectorGui/src/qDetectorMain.cpp
+++ b/slsDetectorGui/src/qDetectorMain.cpp
@@ -223,10 +223,12 @@ void qDetectorMain::Initialization(){
connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs()));
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool)));
+ // Data Output Tab
+ connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool)));
// Plot tab
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
// Actions tab
- connect(tab_actions, SIGNAL(EnableScanBox(int,int)), tab_plot,SLOT(EnableScanBox(int,int)));
+ connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox()));
// Plotting
// When the acquisition is finished, must update the meas tab
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
@@ -269,7 +271,6 @@ void qDetectorMain::EnableModes(QAction *action){
else if(action==actionExpert){
enable = actionExpert->isChecked();
tabs->setTabEnabled(Advanced,enable);
- tab_settings->EnableExpertMode(enable);
#ifdef VERBOSE
cout << "Setting Expert Mode to " << enable << endl;
#endif
diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp
index bd54aac77..7c26be425 100644
--- a/slsDetectorGui/src/qDrawPlot.cpp
+++ b/slsDetectorGui/src/qDrawPlot.cpp
@@ -66,7 +66,7 @@ void qDrawPlot::SetupWidgetWindow(){
nPixelsX = myDet->getTotalNumberOfChannels();
nPixelsY = 100;
-
+ minPixelsY = 0;
lastImageArray = 0;
image_data = 0;
//1d
@@ -77,12 +77,12 @@ void qDrawPlot::SetupWidgetWindow(){
currentPersistency = 0;
progress = 0;
plotEnable=true;
+
+ saveAll = false;
plotDotted = false;
XYRangeChanged = false;
timerValue = PLOT_TIMER_MS;
frameFactor=0;
- oldCopy = false;
- oldFrameNumber = 0;
data_pause_over = true;//to get the first image
isFrameEnabled = false;
isTriggerEnabled = false;
@@ -177,38 +177,36 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
//to get the first image
data_pause_over = true;
+
// Number of Exposures
int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1));
int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1));
-
numFrames = ((numFrames==0)?1:numFrames);
numTriggers = ((numTriggers==0)?1:numTriggers);
- number_of_exposures = numFrames * numTriggers;
- //cout << "\tNumber of Exposures:" << number_of_exposures << endl;
- /* have to also look at vector created using npixelsy as size*/
- if(scanArgument==AllFrames)
- nPixelsY = number_of_exposures;
- else nPixelsY = 100;
+ number_of_frames = numFrames * numTriggers;
+ cout << "\tNumber of Frames per Scan/Measurement:" << number_of_frames << endl;
- //get #pos and #scansets for level 0 and level 1
- int numPos = myDet->getPositions(); numPos = ((numPos==0)?1:numPos);
+ //get #scansets for level 0 and level 1
int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0);
int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1);
- number_of_exposures = number_of_exposures * numPos * numScan0 * numScan1;
+ number_of_exposures = number_of_frames * numScan0 * numScan1;
cout << "\tNumber of Exposures:" << number_of_exposures << endl;
-
// ExposureTime
exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9);
cout << "\tExposure Time:" << setprecision (10) << exposureTime << endl;
// Acquisition Period
acquisitionPeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9);
cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl;
- // Current Index
- currentIndex = myDet->getFileIndex();
- cout << "\tCurrent Index:" << currentIndex << endl;
+
+
+ //for save automatically,
+ saveError = false;
+ lastSavedFrame = -1;
+ lastSavedMeasurement = -1;
+
StartDaq(true);
running=!running;
@@ -266,21 +264,74 @@ bool qDrawPlot::StartOrStopThread(bool start){
progress = 0;
currentFrame = 0;
stop_signal = 0;
- oldFrameNumber = 0;
+
+ //for 2d scans
+ int currentIndex = myDet->getFileIndex();
+ currentScanValue = 0;
+ currentScanDivLevel = 0;
+
+
+ if(scanArgument!=None){
+ if(scanArgument==AllFrames){
+ maxPixelsY = currentIndex + number_of_exposures - 1;
+ minPixelsY = currentIndex;
+ nPixelsY = number_of_exposures;
+ }else if(scanArgument==FileIndex){
+ maxPixelsY = currentIndex + number_of_frames - 1;
+ minPixelsY = currentIndex;
+ nPixelsY = number_of_frames;
+ }else if(scanArgument==Level0){
+ //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab
+ int numSteps = myDet->getScanSteps(0);
+ //if(values) delete [] values;
+ double *values = new double[numSteps];
+ myDet->getScanSteps(0,values);
+
+ maxPixelsY = values[numSteps-1];
+ minPixelsY = values[0];
+ nPixelsY = numSteps;
+ currentScanValue = values[0];
+ }
+ pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1);
+ startPixel = minPixelsY -(pixelWidth/2);
+ endPixel = maxPixelsY + (pixelWidth/2);
+ }else{//no scan
+ nPixelsY = number_of_exposures;
+ maxPixelsY = 100;
+ minPixelsY = 0;
+ startPixel = -0.5;
+ endPixel = nPixelsY-0.5;
+ }
+ cout<<"nPixelsY:"<start((int)(PLOT_TIMER_MS/2));
- }//if frame factor or last frame of last measurement... for all other factors, RETURN
- else{
- if(((currentFrame+1==number_of_exposures)&&(currentMeasurement+1==number_of_measurements))
- ||(!((currentFrame)%frameFactor)))
- oldCopy = false;//if this works, then we forget old data
- else{
- //lastImageNumber= currentFrame+1;
- currentFrame++;
- currentIndex++;
- progress=(int)data->progressIndex;
- //if theres an old copy, try to get lock again
- if(oldCopy){
-#ifdef VERBOSE
- cout << "Copying old data: " << oldFrameNumber << endl;
-#endif
- if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
- char temp_title[2000];
- // only if you got the lock, do u need to remember lastimagenumber to plot
- lastImageNumber= currentFrame;
- //1d
- if(plot_in_scope==1){
- // Titles
- sprintf(temp_title,"Frame Index%d",oldFrameNumber); histTitle[0] = temp_title;
- // copy data//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double));
- for(int i=currentPersistency;i>0;i--)
- memcpy(histYAxis[i],yvalues[i-1],nPixelsX*sizeof(double));
- memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double));
- }//2d
- else{
- // Titles
- sprintf(temp_title,"Image Index %d",oldFrameNumber);
- imageTitle = temp_title;
- // copy data
- //memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double));
- }
- pthread_mutex_unlock(&(last_image_complete_mutex));
- }
- }
- return 0;
- }
- }
- }
- //if plot disabled, RETURN
+
+ //Plot Disabled
if(!plotEnable) {
progress=(int)data->progressIndex;
- //lastImageNumber= currentFrame+1;
currentFrame++;
- currentIndex++;
return 0;
}
+
+
+
+ //Nth Frame
+ if(frameFactor){
+ //when to copy data
+ if(((currentFrame+1==number_of_exposures)&&(currentMeasurement+1==number_of_measurements))
+ ||(!((currentFrame)%frameFactor)));
+ //return if not
+ else{
+ progress=(int)data->progressIndex;
+ currentFrame++;
+ return 0;
+ }
+ }
+
+
+
+ //Not Nth Frame, Not time out yet
+ else{
+ //if the time is not over, RETURN
+ if(!data_pause_over){
+ progress=(int)data->progressIndex;
+ currentFrame++;
+ return 0;
+ }
+ data_pause_over=false;
+ data_pause_timer->start((int)(PLOT_TIMER_MS/2));
+ }
+
+
//what comes here has plot enabled AND (frame factor OR data pause over )
progress=(int)data->progressIndex;
+
+ //current index
+ currentIndex = myDet->getFileIndexFromFileName(string(data->fileName));
+
+ //scan variable
+ int currentScanVariable0 = myDet->getCurrentScanVariable(0);
+ int currentScanVariable1 = myDet->getCurrentScanVariable(1);
+
+
if((currentFrame)<(number_of_exposures)){
#ifdef VERYVERBOSE
cout << "Reading in image: " << currentIndex << endl;
#endif
-
- //if scan argument is all frames
- if(scanArgument==AllFrames){
- if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
- lastImageNumber= currentFrame+1;
- char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title;
- memcpy(lastImageArray+(currentFrame*nPixelsX),data->values,nPixelsX*sizeof(double));
- pthread_mutex_unlock(&(last_image_complete_mutex));
+ //if scan argument is 2d
+ if(scanArgument!=None){
+ if(scanArgument==AllFrames){
+ /*title should include which scan, also by measurement tab*/
+ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
+ lastImageNumber= currentFrame+1;
+ char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title;
+ memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
+ pthread_mutex_unlock(&(last_image_complete_mutex));
+ }
+ currentFrame++;
+ currentScanDivLevel++;
+ return 0;
}
- currentFrame++;
- currentIndex++;
- return 0;
+ else if(scanArgument==FileIndex){
+ /*title should include which scan, also by measurement tab*/
+ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
+ if(currentIndex == minPixelsY) currentScanDivLevel = 0;
+ lastImageNumber= currentFrame+1;
+ char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title;
+ //memcpy(lastImageArray+(currentIndex*nPixelsX),data->values,nPixelsX*sizeof(double));
+ for(unsigned int px=0;pxvalues[px];
+ pthread_mutex_unlock(&(last_image_complete_mutex));
+ }
+ currentFrame++;
+ currentScanDivLevel++;
+ return 0;
+ }
+ else if(scanArgument==Level0){
+ /*title should include which scan, also by measurement tab*/
+ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
+ if(currentScanVariable0!=currentScanValue) currentScanDivLevel++;
+ currentScanValue = currentScanVariable0;
+
+ lastImageNumber= currentFrame+1;
+ char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title;
+ //memcpy(lastImageArray+(currentIndex*nPixelsX),data->values,nPixelsX*sizeof(double));
+
+ //for(int i=values[currentScan];ivalues,nPixelsX*sizeof(double));
+
+ //memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
+ for(unsigned int px=0;pxvalues[px];
+ cout<<"lastImageArray[0*1280+500]:"<values[px];
+ pthread_mutex_unlock(&(last_image_complete_mutex));
+ }
+ currentFrame++;
+ return 0;
+ }
+
}
-
+ //normal measurement or 1d scans
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
char temp_title[2000];
// only if you got the lock, do u need to remember lastimagenumber to plot
@@ -443,29 +517,8 @@ int qDrawPlot::GetData(detectorData *data){
//SHOULD BE memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double));
}
pthread_mutex_unlock(&(last_image_complete_mutex));
- }//copies old data only if its frame factor
- else if(frameFactor){
- oldCopy = true;
- oldFrameNumber = currentIndex;
- //1D
- if(plot_in_scope==1){
- // Persistency
- if(currentPersistency < persistency)currentPersistency++;
- else currentPersistency=persistency;
- nHists = currentPersistency+1;
- // copy old data
- for(int i=currentPersistency;i>0;i--)
- memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double));
- nHists = currentPersistency+1;
- memcpy(yvalues[0],data->values,nPixelsX*sizeof(double));
- }//2D
- else{
- // copy old data
- //memcpy(image_data,data->values,nPixelsX*nPixelsY*sizeof(double));
- }
}
currentFrame++;
- currentIndex++;
}
}
#ifdef VERYVERBOSE
@@ -548,6 +601,7 @@ void qDrawPlot::UpdatePlot(){
plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
XYRangeChanged = false;
}
+ if(saveAll) SavePlotAutomatic();
}
}
//2-d plot stuff
@@ -555,7 +609,8 @@ void qDrawPlot::UpdatePlot(){
if(lastImageArray){
if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot
nPixelsX>0&&nPixelsY>0){
- plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
+ //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
+ plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);
plot2D->SetYTitle(imageYAxisTitle);
@@ -572,6 +627,7 @@ void qDrawPlot::UpdatePlot(){
plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
XYRangeChanged = false;
}
+ if(saveAll) SavePlotAutomatic();
}
}
last_plot_number=lastImageNumber;
@@ -595,7 +651,6 @@ void qDrawPlot::UpdatePlot(){
}// To start the next measurement
else{
emit SetCurrentMeasurementSignal(currentMeasurement);
- currentIndex++;
StopDaqForGui();
StartDaq(true);
}
@@ -659,6 +714,27 @@ void qDrawPlot::ClonePlot(){
connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int)));
}
+//-------------------------------------------------------------------------------------------------------------------------------------------------
+
+void qDrawPlot::SaveClones(){
+ char errID[200];
+ string errMessage= "The Snapshots with ID's: ";
+ bool success = true;
+ for(int i=0;iSavePlotAutomatic()){
+ success = false;
+ sprintf(errID,"%d",i);
+ errMessage.append(string(errID)+string(", "));
+ }
+ }
+ if(success)
+ qDefs::InfoMessage("The Snapshots have all been saved successfully in .png.","Dock");
+ else
+ qDefs::WarningMessage(errMessage + string("were not saved."),"Dock");
+}
+
+
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDrawPlot::CloseClones(){
@@ -697,6 +773,57 @@ void qDrawPlot::SavePlot(){
"Formats: .png, .jpg, .xpm.","Dock");
}
+
+//-------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+void qDrawPlot::SaveAll(bool enable){
+ string msg = string("The Files will be saved as:\n")+
+ string(myDet->getFilePath().c_str())+string("/")+
+ string(myDet->getFileName().c_str())+string("_[File Index].png");
+ qDefs::InfoMessage(msg,"Dock");
+ saveAll = enable;
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------------------------
+
+void qDrawPlot::SavePlotAutomatic(){
+ //no need to save the same plot many times
+ if((currentFrame>lastSavedFrame)&&(currentMeasurement>=lastSavedMeasurement)){
+ lastSavedFrame = currentFrame;
+ lastSavedMeasurement = currentMeasurement;
+ char cID[10];
+ sprintf(cID,"%d",lastSavedFrame);
+ QString fName = QString(myDet->getFilePath().c_str())+QString("/")+
+ QString(myDet->getFileName().c_str())+QString("_")+
+ QString(cID)+".png";
+ QImage img(size().width(),size().height(),QImage::Format_RGB32);
+ QPainter painter(&img);
+ render(&painter);
+ //if error while saving
+ if(!img.save(fName)){
+ //mention the error only the first time
+ if(!saveError){
+ //so it doesnt repeat again
+ saveError = true;
+ connect(this,SIGNAL(saveErrorSignal(QString)),this,SLOT(ShowSaveErrorMessage(QString)));
+ emit saveErrorSignal(fName);
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+void qDrawPlot::ShowSaveErrorMessage(QString fileName){
+ qDefs::WarningMessage(string("Automatic Saving: Could not save the first file:\n")+
+ string(fileName.toAscii().constData()) + string("\n\nNote: Will not show future file save errors for this acquisition."),"Dock");
+
+}
+
+
//-------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp
index 8ce46108e..158db4b0b 100644
--- a/slsDetectorGui/src/qScanWidget.cpp
+++ b/slsDetectorGui/src/qScanWidget.cpp
@@ -385,7 +385,7 @@ int qScanWidget::SetScan(int mode){
}
}
- emit EnableScanBox(actualMode,id);
+ emit EnableScanBox();
return qDefs::OK;
}
diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp
index e315c4858..1c39a0420 100644
--- a/slsDetectorGui/src/qTabActions.cpp
+++ b/slsDetectorGui/src/qTabActions.cpp
@@ -81,13 +81,6 @@ void qTabActions::SetupWidgetWindow(){
btnExpand[i]->setToolTip(tip);
group->addButton(btnExpand[i],i);
- //Number of positions is only for mythen or gotthard
- slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
- if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) {
- lblName[NumPositions]->setEnabled(false);
- btnExpand[NumPositions]->setEnabled(false);
- }
-
//add the widgets to the layout , depending on the type create the widgets
gridLayout->addWidget(btnExpand[i],(i*2),0);
gridLayout->addWidget(lblName[i],(i*2),1);
@@ -111,6 +104,21 @@ void qTabActions::SetupWidgetWindow(){
}
+ //Number of positions is only for mythen or gotthard
+ detType = myDet->getDetectorsType();
+ if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) {
+ lblName[NumPositions]->setEnabled(false);
+ btnExpand[NumPositions]->setEnabled(false);
+ }else{
+ //disable positions if angular conversion is enabled
+ int ang;
+ if(!myDet->getAngularConversion(ang)){
+ lblName[NumPositions]->setEnabled(false);
+ btnExpand[NumPositions]->setEnabled(false);
+ }
+
+ }
+
}
@@ -181,7 +189,7 @@ void qTabActions::Initialization(){
connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
//enable scan box in plot tab
for(int i=0;isetEnabled(true);
+ btnExpand[NumPositions]->setEnabled(true);
+ }else{
+ //to collapse if it was expanded
+ if(btnExpand[NumPositions]->text()=="-")
+ Expand(group->button(NumPositions));
+ comboPos->clear();
+ lblName[NumPositions]->setPalette(lblName[NumPositions-1]->palette());
+ lblName[NumPositions]->setEnabled(false);
+ btnExpand[NumPositions]->setEnabled(false);
+ }
+}
+
+
//-------------------------------------------------------------------------------------------------------------------------------------------------
@@ -308,38 +337,43 @@ void qTabActions::Refresh(){
#ifdef VERBOSE
cout << "\nUpdating all action widgets " << endl;
#endif
- if(lblName[NumPositions]->isEnabled()){
- //delete existing positions
- if (positions) delete [] positions;
- //get number of positions
- int numPos=myDet->getPositions();
- comboPos->setMaxCount(numPos);
+ if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){
+ //positions is enabled only if angular conversion is enabled
+ int ang; if(!myDet->getAngularConversion(ang)) EnablePositions(false);
- //set the number of positions in the gui
- disconnect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
- spinNumPos->setValue(numPos);
- connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
+ if(lblName[NumPositions]->isEnabled()){
+ //delete existing positions
+ if (positions) delete [] positions;
+ //get number of positions
+ int numPos=myDet->getPositions();
+ comboPos->setMaxCount(numPos);
- positions=new double[numPos];
- //load the positions
- myDet->getPositions(positions);
+ //set the number of positions in the gui
+ disconnect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
+ spinNumPos->setValue(numPos);
+ connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
- //delete the combolist and reload it
- disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
- comboPos->setEnabled(numPos);
- lblPosList->setEnabled(numPos);
- lblPosList->setText("List of Positions: ");
- lblPosList->setPalette(normal);
- for(int i=0;icount();i++)
- comboPos->removeItem(i);
- for(int i=0;iinsertItem(i,QString("%1").arg(positions[i]));
- connect(comboPos, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
+ positions=new double[numPos];
+ //load the positions
+ myDet->getPositions(positions);
+
+ //delete the combolist and reload it
+ disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
+ comboPos->setEnabled(numPos);
+ lblPosList->setEnabled(numPos);
+ lblPosList->setText("List of Positions: ");
+ lblPosList->setPalette(normal);
+ for(int i=0;icount();i++)
+ comboPos->removeItem(i);
+ for(int i=0;iinsertItem(i,QString("%1").arg(positions[i]));
+ connect(comboPos, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
#ifdef VERBOSE
- cout << "Updated position widget\tnum:" << numPos << endl << endl;
+ cout << "Updated position widget\tnum:" << numPos << endl << endl;
#endif
+ }
}
for(int i=0;iRefresh();
diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp
index 3aeb9512f..9c570092c 100644
--- a/slsDetectorGui/src/qTabDataOutput.cpp
+++ b/slsDetectorGui/src/qTabDataOutput.cpp
@@ -343,16 +343,21 @@ void qTabDataOutput::SetAngularCorrection(){
cout << "Entering Set Angular Correction function" << endl;
#endif
if(chkAngular->isChecked()){
- myDet->setAngularConversionFile("default");
+ if(myDet->setAngularConversionFile("default")){
#ifdef VERBOSE
cout << "Setting angular conversion to default" << endl;
#endif
+ }else{
+ qDefs::WarningMessage("Angular Conversion could not be set.","Data Output");
+ chkAngular->setChecked(false);
+ }
}else{
myDet->setAngularConversionFile("");
#ifdef VERBOSE
cout << "Unsetting angular correction" << endl;
#endif
}
+ emit AngularConversionSignal(chkAngular->isChecked());
}
@@ -393,6 +398,7 @@ void qTabDataOutput::Refresh(){
int ang;
if(myDet->getAngularConversion(ang))
chkAngular->setChecked(true);
+ emit AngularConversionSignal(chkAngular->isChecked());
}
//discard bad channels from server
if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true);
diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp
index 2feb82ea3..f76cd10aa 100644
--- a/slsDetectorGui/src/qTabPlot.cpp
+++ b/slsDetectorGui/src/qTabPlot.cpp
@@ -94,6 +94,20 @@ void qTabPlot::SetupWidgetWindow(){
dispYMax->setValidator(new QDoubleValidator(dispYMax));
dispZMax->setValidator(new QDoubleValidator(dispZMax));
+ //default titles
+ dispTitle->setText(defaultPlotTitle);
+ myPlot->SetPlotTitle(defaultPlotTitle);
+ dispXAxis->setText(defaultHistXAxisTitle);
+ dispYAxis->setText(defaultHistYAxisTitle);
+ myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
+ myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
+ dispXAxis->setText(defaultImageXAxisTitle);
+ dispYAxis->setText(defaultImageYAxisTitle);
+ dispZAxis->setText(defaultImageZAxisTitle);
+ myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
+ myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
+ myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
+
// Plotting Frequency
stackedLayout = new QStackedLayout;
@@ -147,18 +161,12 @@ void qTabPlot::SetupWidgetWindow(){
void qTabPlot::Select1DPlot(bool b){
isOneD = b;
- dispTitle->setText(defaultPlotTitle);
- myPlot->SetPlotTitle(defaultPlotTitle);
if(b){
box1D->show();
box2D->hide();
chkZAxis->setEnabled(false);
chkZMin->setEnabled(false);
chkZMax->setEnabled(false);
- dispXAxis->setText(defaultHistXAxisTitle);
- dispYAxis->setText(defaultHistYAxisTitle);
- myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
- myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
myPlot->Select1DPlot();
}else{
box1D->hide();
@@ -166,15 +174,8 @@ void qTabPlot::Select1DPlot(bool b){
chkZAxis->setEnabled(true);
chkZMin->setEnabled(true);
chkZMax->setEnabled(true);
- dispXAxis->setText(defaultImageXAxisTitle);
- dispYAxis->setText(defaultImageYAxisTitle);
- dispZAxis->setText(defaultImageZAxisTitle);
- myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
- myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
- myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
myPlot->Select2DPlot();
}
-
}
@@ -188,9 +189,11 @@ void qTabPlot::Initialization(){
connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
// Scan box
connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument()));
+ connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
// Snapshot box
connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot()));
connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones()));
+ connect(btnSaveClones, SIGNAL(clicked()),myPlot, SLOT(SaveClones()));
// 1D Plot box
connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int)));
@@ -228,12 +231,14 @@ void qTabPlot::Initialization(){
connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange()));
connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange()));
+// Save
+ connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
+ connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool)));
connect(this,SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double)));
-// Common Buttons
-// Save
- connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
+
+
}
@@ -485,7 +490,7 @@ void qTabPlot::SetFrequency(){
//-------------------------------------------------------------------------------------------------------------------------------------------------
-void qTabPlot::EnableScanBox(int mode,int id){
+void qTabPlot::EnableScanBox(){
#ifdef VERYVERBOSE
cout << "Entering Enable Scan Box() \t mode:" << mode << " \t id:" << id << endl;
#endif
@@ -493,25 +498,42 @@ void qTabPlot::EnableScanBox(int mode,int id){
int mode0 = myDet->getScanMode(0);
int mode1 = myDet->getScanMode(1);
+ //if it was checked before or disabled before, it remembers to check it again
+ bool checkedBefore = (boxScan->isChecked()||(!boxScan->isEnabled()));
+ //only now enable/disable
boxScan->setEnabled(mode0||mode1);
+ //if there are scan
if(boxScan->isEnabled()){
//make sure nth frame frequency plot is disabled
EnablingNthFrameFunction(false);
- //if level0 or 1, check argument to find which scan enabled last from actions tab
- if((btnGroupScan->checkedId()!=2)&&(btnGroupScan->checkedId()!=3)){
- cout<<"mode:"<0){
- if(!id) radioLevel0->setChecked(true);
- else radioLevel1->setChecked(true);
+ //if 2d is chosen or not for scan
+ if(boxScan->isChecked()){
+
+ boxScan->setChecked(checkedBefore);
+ //make sure nth frame frequency plot is disabled
+ EnablingNthFrameFunction(false);
+
+ //
+ if(mode0 && mode1){
+ if(!radioFileIndex->isChecked()) radioAllFrames->setChecked(true);
+ radioLevel0->setEnabled(false);
+ radioLevel1->setEnabled(false);
+ }else{
+ radioLevel0->setEnabled(mode0);
+ radioLevel1->setEnabled(mode1);
+ }
+
+ //only if level0 or level1 is checked
+ if((radioLevel0->isChecked())||(radioLevel1->isChecked())){
+ if(mode0) radioLevel0->setChecked(true);
+ if(mode1) radioLevel1->setChecked(true);
}
}
+ }
+ else EnablingNthFrameFunction(enableNFrame);
- radioLevel0->setEnabled(mode0);
- radioLevel1->setEnabled(mode1);
- }else EnablingNthFrameFunction(enableNFrame);
//sets the scan argument
SetScanArgument();
@@ -542,13 +564,13 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
-
+/** What happens for 2d????*/
void qTabPlot::SetScanArgument(){
//as default from histogram and default titles are set here if scanbox is disabled
Select1DPlot(isOrginallyOneD);
- //this function is also called just to update, could be no scan
+ //if scans
if(boxScan->isEnabled()){
//setting the title according to the scans
@@ -556,52 +578,58 @@ void qTabPlot::SetScanArgument(){
QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString("");
dispTitle->setText(mainTitle);
myPlot->SetPlotTitle(mainTitle);
+ }else{
+ dispTitle->setText(defaultPlotTitle);
+ myPlot->SetPlotTitle(defaultPlotTitle);
+ dispXAxis->setText(defaultHistXAxisTitle);
+ dispYAxis->setText(defaultHistYAxisTitle);
+ myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
+ myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
+ dispXAxis->setText(defaultImageXAxisTitle);
+ dispYAxis->setText(defaultImageYAxisTitle);
+ dispZAxis->setText(defaultImageZAxisTitle);
+ myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
+ myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
+ myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
+ }
+ //for 2d
+ if((boxScan->isEnabled())&&(boxScan->isChecked())){
//let qdrawplot know which scan argument
myPlot->SetScanArgument(btnGroupScan->checkedId()+1);
- /** What happens for 2d????*/
- //settings the x and y titles
+
+ //default titles for 2d scan
+ dispXAxis->setText("Channel Number");
+ myPlot->SetImageXAxisTitle("Channel Number");
+ dispZAxis->setText("Counts");
+ myPlot->SetImageZAxisTitle("Counts");
+
+ //titles for y of 2d scan
switch(btnGroupScan->checkedId()){
- //level0
- case 0:
- dispXAxis->setText("Channel Number");
+ case 0://level0
dispYAxis->setText("Scan Level 0");
- myPlot->SetHistXAxisTitle("Channel Number");
- myPlot->SetHistYAxisTitle("Scan Level 0");
- myPlot->Select1DPlot();
+ myPlot->SetImageYAxisTitle("Scan Level 0");
break;
-
- //level1
- case 1:
- dispXAxis->setText("Channel Number");
+ case 1://level1
dispYAxis->setText("Scan Level 1");
- myPlot->SetHistXAxisTitle("Channel Number");
- myPlot->SetHistYAxisTitle("Scan Level 1");
- myPlot->Select1DPlot();
+ myPlot->SetImageYAxisTitle("Scan Level 1");
break;
-
- //file index
- case 2:
- dispXAxis->setText("Channel Number");
+ break;
+ case 2://file index
dispYAxis->setText("File Index");
- myPlot->SetHistXAxisTitle("Channel Number");
- myPlot->SetHistYAxisTitle("File Index");
- myPlot->Select1DPlot();
+ myPlot->SetImageYAxisTitle("File Index");
break;
-
- //all frames
- case 3:
- Select1DPlot(false);
- dispXAxis->setText("Channel Number");
- dispYAxis->setText("Threshold");
- dispZAxis->setText("Intensity");
- myPlot->SetImageXAxisTitle("Channel Number");
- myPlot->SetImageYAxisTitle("Threshold");
- myPlot->SetImageZAxisTitle("Intensity");
- myPlot->Select2DPlot();
+ case 3://all frames
+ dispYAxis->setText("All Frames");
+ myPlot->SetImageYAxisTitle("All Frames");
break;
}
+
+ //set plot to 2d
+ Select1DPlot(false);
+ myPlot->Select2DPlot();
+
}else //done here so that it isnt set by default each time
myPlot->SetScanArgument(0);
diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp
index 43939e73e..430046fde 100644
--- a/slsDetectorGui/src/qTabSettings.cpp
+++ b/slsDetectorGui/src/qTabSettings.cpp
@@ -17,7 +17,7 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID):
- QWidget(parent),myDet(detector),detID(detID), expertMode(false){
+ QWidget(parent),myDet(detector),detID(detID){
setupUi(this);
SetupWidgetWindow();
@@ -172,9 +172,9 @@ void qTabSettings::setSettings(int index){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
- lblThreshold->setEnabled(expertMode);
- spinThreshold->setEnabled(expertMode);
- if(expertMode) SetEnergy();
+ lblThreshold->setEnabled(true);
+ spinThreshold->setEnabled(true);
+ SetEnergy();
}
}
}
@@ -273,9 +273,9 @@ void qTabSettings::Refresh(){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
- lblThreshold->setEnabled(expertMode);
- spinThreshold->setEnabled(expertMode);
- if(expertMode) SetEnergy();
+ lblThreshold->setEnabled(true);
+ spinThreshold->setEnabled(true);
+ SetEnergy();
}
}