mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40:03 +02:00
WIP
This commit is contained in:
parent
61b937e2e0
commit
06834617de
@ -19,7 +19,8 @@ class qCloneWidget : public QMainWindow {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim, std::string FilePath,
|
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim,
|
||||||
|
QString filePath, QString fileName, int fileIndex,
|
||||||
bool displayStats, QString min, QString max, QString sum);
|
bool displayStats, QString min, QString max, QString sum);
|
||||||
~qCloneWidget();
|
~qCloneWidget();
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class qCloneWidget : public QMainWindow {
|
|||||||
* @param lines style of plot if lines or dots
|
* @param lines style of plot if lines or dots
|
||||||
* @param markers style of plot markers or not
|
* @param markers style of plot markers or not
|
||||||
*/
|
*/
|
||||||
void SetCloneHists(int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers);
|
void SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 1D hist values to plot for angle plotting
|
* Get the 1D hist values to plot for angle plotting
|
||||||
@ -76,7 +77,9 @@ class qCloneWidget : public QMainWindow {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int id;
|
int id;
|
||||||
std::string filePath;
|
QString filePath;
|
||||||
|
QString fileName;
|
||||||
|
int imageIndex;
|
||||||
SlsQt1DPlot *cloneplot1D;
|
SlsQt1DPlot *cloneplot1D;
|
||||||
SlsQt2DPlotLayout *cloneplot2D;
|
SlsQt2DPlotLayout *cloneplot2D;
|
||||||
QVector<SlsQtH1D *> cloneplot1D_hists;
|
QVector<SlsQtH1D *> cloneplot1D_hists;
|
||||||
|
@ -32,27 +32,33 @@ class qDrawPlot : public QWidget {
|
|||||||
/** Destructor */
|
/** Destructor */
|
||||||
~qDrawPlot();
|
~qDrawPlot();
|
||||||
|
|
||||||
/** If the gui client has started or stopped */
|
// measurement tab
|
||||||
void SetClientInitiated();
|
void SetClientInitiated();
|
||||||
bool GetClientInitiated();
|
bool GetClientInitiated();
|
||||||
|
// main
|
||||||
bool isRunning();
|
bool isRunning();
|
||||||
|
// from measurement tabs
|
||||||
int GetProgress();
|
int GetProgress();
|
||||||
int GetCurrentFrameIndex();
|
int GetCurrentFrameIndex();
|
||||||
|
// from plot tab
|
||||||
|
void Select1dPlot(bool enable);
|
||||||
void SetPlotTitlePrefix(QString title);
|
void SetPlotTitlePrefix(QString title);
|
||||||
void SetXAxisTitle(QString title);
|
void SetXAxisTitle(QString title);
|
||||||
void SetYAxisTitle(QString title);
|
void SetYAxisTitle(QString title);
|
||||||
void SetZAxisTitle(QString title);
|
void SetZAxisTitle(QString title);
|
||||||
void DisableZoom(bool disable);
|
void DisableZoom(bool disable);
|
||||||
void SetXYRange(bool changed);
|
void SetXYRangeChanged();
|
||||||
void SetXYRangeValues(double val, qDefs::range xy);
|
void SetXYRangeValues(double val, qDefs::range xy);
|
||||||
void IsXYRangeValues(bool changed, qDefs::range xy);
|
void IsXYRangeValues(bool changed, qDefs::range xy);
|
||||||
double GetXMinimum();
|
double GetXMinimum();
|
||||||
double GetXMaximum();
|
double GetXMaximum();
|
||||||
double GetYMinimum();
|
double GetYMinimum();
|
||||||
double GetYMaximum();
|
double GetYMaximum();
|
||||||
|
void SetZRange(bool isZmin, bool isZmax, double zmin, double zmax);
|
||||||
void SetDataCallBack(bool enable);
|
void SetDataCallBack(bool enable);
|
||||||
void SetBinary(bool enable, int from = 0, int to = 0);
|
void SetBinary(bool enable, int from = 0, int to = 0);
|
||||||
|
|
||||||
|
|
||||||
/** Starts or stop acquisition
|
/** Starts or stop acquisition
|
||||||
* Calls startDaq() function
|
* Calls startDaq() function
|
||||||
* @param stop_if_running is 0 to stop acquisition and 1 to start
|
* @param stop_if_running is 0 to stop acquisition and 1 to start
|
||||||
@ -61,25 +67,29 @@ class qDrawPlot : public QWidget {
|
|||||||
void StartStopDaqToggle(bool stop_if_running = 0);
|
void StartStopDaqToggle(bool stop_if_running = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void StopAcquisition();
|
|
||||||
void SetPersistency(int val);
|
void SetPersistency(int val);
|
||||||
void SetLines(bool enable);
|
void SetLines(bool enable);
|
||||||
void SetMarkers(bool enable);
|
void SetMarkers(bool enable);
|
||||||
|
void Set1dLogY(bool enable);
|
||||||
|
void SetInterpolate(bool enable);
|
||||||
|
void SetContour(bool enable);
|
||||||
|
void SetLogz(bool enable);
|
||||||
void SetPedestal(bool enable);
|
void SetPedestal(bool enable);
|
||||||
void RecalculatePedestal();
|
void RecalculatePedestal();
|
||||||
void SetAccumulate(bool enable);
|
void SetAccumulate(bool enable);
|
||||||
void ResetAccumulate();
|
void ResetAccumulate();
|
||||||
void DisplayStatistics(bool enable);
|
void DisplayStatistics(bool enable);
|
||||||
|
void EnableGainPlot(bool enable);
|
||||||
void ClonePlot();
|
void ClonePlot();
|
||||||
void CloseClones();
|
void CloseClones();
|
||||||
void SaveClones();
|
void SaveClones();
|
||||||
void SavePlot();
|
void SavePlot();
|
||||||
void Select1DPlot();
|
|
||||||
void Select2DPlot();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void SetSaveFileName(QString val);
|
||||||
void CloneCloseEvent(int id);
|
void CloneCloseEvent(int id);
|
||||||
void EnableGainPlot(bool e);
|
|
||||||
|
|
||||||
void UpdatePlot();
|
void UpdatePlot();
|
||||||
void StartDaq(bool start);
|
void StartDaq(bool start);
|
||||||
@ -87,31 +97,24 @@ class qDrawPlot : public QWidget {
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void UpdatingPlotFinished();
|
void UpdatingPlotFinished();
|
||||||
void InterpolateSignal(bool);
|
|
||||||
void ContourSignal(bool);
|
|
||||||
void LogzSignal(bool);
|
|
||||||
void LogySignal(bool);
|
|
||||||
void ResetZMinZMaxSignal(bool, bool, double, double);
|
|
||||||
void SetCurrentMeasurementSignal(int);
|
void SetCurrentMeasurementSignal(int);
|
||||||
void AcquisitionErrorSignal(QString);
|
void AcquisitionErrorSignal(QString);
|
||||||
void UpdatePlotSignal();
|
void UpdatePlotSignal();
|
||||||
void GainPlotSignal(bool);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void SetupStatistics();
|
void SetupStatistics();
|
||||||
void SetupPlots();
|
void SetupPlots();
|
||||||
const char *GetTitle1d(int histIndex);
|
|
||||||
double *GetHistYAxis(int histIndex);
|
|
||||||
void SetStyle(SlsQtH1D *h);
|
|
||||||
void GetStatistics(double &min, double &max, double &sum, double *array, int size);
|
|
||||||
void SelectPlot(int i = 2);
|
|
||||||
void Clear1DPlot();
|
|
||||||
|
|
||||||
|
|
||||||
int LockLastImageArray();
|
int LockLastImageArray();
|
||||||
int UnlockLastImageArray();
|
int UnlockLastImageArray();
|
||||||
|
void SetStyle(SlsQtH1D *h);
|
||||||
|
void GetStatistics(double &min, double &max, double &sum, double *array, int size);
|
||||||
|
void DetachHists();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int StartDaqForGui();
|
int StartDaqForGui();
|
||||||
int StopDaqForGui();
|
int StopDaqForGui();
|
||||||
bool StartOrStopThread(bool start);
|
bool StartOrStopThread(bool start);
|
||||||
@ -132,7 +135,7 @@ class qDrawPlot : public QWidget {
|
|||||||
slsDetectorDefs::detectorType detType;
|
slsDetectorDefs::detectorType detType;
|
||||||
|
|
||||||
SlsQt1DPlot *plot1d{nullptr};
|
SlsQt1DPlot *plot1d{nullptr};
|
||||||
QVector<SlsQtH1D *> hists1d;
|
QVector<SlsQtH1D *> hists1d;
|
||||||
SlsQt2DPlotLayout *plot2d{nullptr};
|
SlsQt2DPlotLayout *plot2d{nullptr};
|
||||||
SlsQt2DPlotLayout *gainplot2d{nullptr};
|
SlsQt2DPlotLayout *gainplot2d{nullptr};
|
||||||
|
|
||||||
@ -145,18 +148,17 @@ class qDrawPlot : public QWidget {
|
|||||||
bool plotRequired{false};/**?? */
|
bool plotRequired{false};/**?? */
|
||||||
bool running{false};
|
bool running{false};
|
||||||
int progress{0};
|
int progress{0};
|
||||||
volatile bool stopSignal{false};
|
bool clientInitiated{false};
|
||||||
bool clientInitiated{false};
|
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
QString plotTitle{""};
|
QString plotTitle{""};
|
||||||
QString plotTitle_prefix{""};
|
QString plotTitle_prefix{""};
|
||||||
QLabel *lblFrameIndexTitle1d{nullptr};
|
QLabel *lblFrameIndexTitle1d{nullptr};
|
||||||
std::vector<std::string> title1d;
|
std::vector<std::string> title1d;
|
||||||
std::string title2d{""};
|
std::string title2d{""};
|
||||||
QString xTitle1d{"Channel Number"};
|
QString xTitle1d{"Channel Number"};
|
||||||
QString yTitle1d{"Counts"};
|
QString yTitle1d{"Counts"};
|
||||||
QString xTitle2d{"Pixel"};
|
QString xTitle2d{"Pixel"};
|
||||||
QString yTitle2d{"Pixel"};
|
QString yTitle2d{"Pixel"};
|
||||||
QString zTitle2d{"Intensity"};
|
QString zTitle2d{"Intensity"};
|
||||||
bool XYRangeChanged{false};
|
bool XYRangeChanged{false};
|
||||||
@ -164,17 +166,16 @@ class qDrawPlot : public QWidget {
|
|||||||
bool isXYRangeEnable[4]{false, false, false, false};
|
bool isXYRangeEnable[4]{false, false, false, false};
|
||||||
|
|
||||||
// data
|
// data
|
||||||
unsigned int nHists{0};
|
unsigned int nHists{1};
|
||||||
int histNBins{0};
|
double *datax1d{nullptr};
|
||||||
double *x1d{nullptr};
|
std::vector<double *> datay1d;
|
||||||
std::vector<double *> y1d;
|
double *data2d{nullptr};
|
||||||
double *image2d{nullptr};
|
|
||||||
|
|
||||||
//options
|
//options
|
||||||
bool binary{false};
|
bool binary{false};
|
||||||
int binaryFrom{0};
|
int binaryFrom{0};
|
||||||
int binaryTo{0};
|
int binaryTo{0};
|
||||||
int persistency0};
|
int persistency{0};
|
||||||
int currentPersistency0};
|
int currentPersistency0};
|
||||||
bool isLines{true};
|
bool isLines{true};
|
||||||
bool isMarkers{false};
|
bool isMarkers{false};
|
||||||
|
@ -66,8 +66,7 @@ private:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void StartSignal();
|
void StartSignal();
|
||||||
void StopSignal();
|
void FileNameChangedSignal(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
qDrawPlot *myPlot;
|
qDrawPlot *myPlot;
|
||||||
|
@ -40,7 +40,6 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void DisableZoomSignal(bool);
|
void DisableZoomSignal(bool);
|
||||||
void ResetZMinZMaxSignal(bool,bool,double,double);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
@ -53,7 +52,7 @@ private:
|
|||||||
|
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
qDrawPlot *myPlot;
|
qDrawPlot *myPlot;
|
||||||
bool isOneD;
|
bool is1d;
|
||||||
|
|
||||||
QButtonGroup *btnGroupPlotType;
|
QButtonGroup *btnGroupPlotType;
|
||||||
QStackedLayout *stackedLayout;
|
QStackedLayout *stackedLayout;
|
||||||
|
@ -133,6 +133,9 @@ class SlsQt1DPlot:public QwtPlot{
|
|||||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}
|
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}
|
||||||
|
|
||||||
void alignScales();
|
void alignScales();
|
||||||
|
|
||||||
|
void SetLogX(bool yes=1);
|
||||||
|
void SetLogY(bool yes=1);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SlsQtH1DList* hist_list;
|
SlsQtH1DList* hist_list;
|
||||||
@ -160,11 +163,6 @@ class SlsQt1DPlot:public QwtPlot{
|
|||||||
void UnZoom();
|
void UnZoom();
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
void SetLogX(bool yes=1);
|
|
||||||
void SetLogY(bool yes=1);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,10 +101,10 @@ public:
|
|||||||
void FillTestPlot(int i=0);
|
void FillTestPlot(int i=0);
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
public slots:
|
|
||||||
void LogZ(bool on=1);
|
void LogZ(bool on=1);
|
||||||
void InterpolatedPlot(bool on);
|
void InterpolatedPlot(bool on);
|
||||||
void showContour(bool on);
|
void showContour(bool on);
|
||||||
|
public slots:
|
||||||
void showSpectrogram(bool on);
|
void showSpectrogram(bool on);
|
||||||
// void printPlot();
|
// void printPlot();
|
||||||
|
|
||||||
|
@ -23,7 +23,11 @@ public:
|
|||||||
void SetYTitle(QString st);
|
void SetYTitle(QString st);
|
||||||
void SetZTitle(QString st);
|
void SetZTitle(QString st);
|
||||||
void KeepZRangeIfSet();
|
void KeepZRangeIfSet();
|
||||||
|
// recalculate zmin and zmax from plot and update z range
|
||||||
|
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||||
|
void SetInterpolate(bool enable);
|
||||||
|
void SetContour(bool enable);
|
||||||
|
void SetLogz(bool enable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGridLayout* the_layout;
|
QGridLayout* the_layout;
|
||||||
@ -32,7 +36,6 @@ private:
|
|||||||
QToolButton* btnLogz;
|
QToolButton* btnLogz;
|
||||||
SlsQt2DPlot* the_plot;
|
SlsQt2DPlot* the_plot;
|
||||||
|
|
||||||
void ConnectSignalsAndSlots();
|
|
||||||
void Layout();
|
void Layout();
|
||||||
bool isLog;
|
bool isLog;
|
||||||
double zmin;
|
double zmin;
|
||||||
@ -43,14 +46,8 @@ private:
|
|||||||
public slots:
|
public slots:
|
||||||
void SetZScaleToLog(bool enable);
|
void SetZScaleToLog(bool enable);
|
||||||
void ResetRange();
|
void ResetRange();
|
||||||
// recalculate zmin and zmax from plot and update z range
|
|
||||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
|
||||||
// update z range
|
// update z range
|
||||||
void UpdateZRange(double min, double max) ;
|
void UpdateZRange(double min, double max) ;
|
||||||
|
|
||||||
signals:
|
|
||||||
void InterpolateSignal(bool);
|
|
||||||
void ContourSignal(bool);
|
|
||||||
void LogzSignal(bool);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,6 @@ SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
|||||||
isZmin = false;
|
isZmin = false;
|
||||||
isZmax = false;
|
isZmax = false;
|
||||||
Layout();
|
Layout();
|
||||||
ConnectSignalsAndSlots();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
||||||
@ -32,11 +31,7 @@ void SlsQt2DPlotLayout::Layout(){
|
|||||||
the_layout->addWidget(the_plot,2,0,3,3);
|
the_layout->addWidget(the_plot,2,0,3,3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
|
|
||||||
connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool)));
|
|
||||||
connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool)));
|
|
||||||
connect(this, SIGNAL(LogzSignal(bool)), this, SLOT(SetZScaleToLog(bool)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
|
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
|
||||||
UpdateZRange(zmin, zmax);
|
UpdateZRange(zmin, zmax);
|
||||||
@ -52,6 +47,7 @@ void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max
|
|||||||
UpdateZRange(min, max);
|
UpdateZRange(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
||||||
if(isLog) {
|
if(isLog) {
|
||||||
the_plot->SetZMinimumToFirstGreaterThanZero();
|
the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||||
@ -72,8 +68,15 @@ void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
|||||||
the_plot->Update();
|
the_plot->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::SetZScaleToLog(bool enable) {
|
void SlsQt2DPlotLayout::SetInterpolate(bool enable) {
|
||||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Z Scale to log";
|
the_plot->InterpolatedPlot(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlsQt2DPlotLayout::SetContour(bool enable) {
|
||||||
|
the_plot->showContour(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlsQt2DPlotLayout::SetLogz(bool enable) {
|
||||||
isLog = enable;
|
isLog = enable;
|
||||||
the_plot->LogZ(enable);
|
the_plot->LogZ(enable);
|
||||||
SetZRange(isZmin, isZmax, zmin, zmax);
|
SetZRange(isZmin, isZmax, zmin, zmax);
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle,
|
qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle,
|
||||||
int numDim, std::string FilePath, bool displayStats, QString min, QString max, QString sum) :
|
int numDim, QString fPath, QString fName, int fIndex, bool displayStats, QString min, QString max, QString sum) :
|
||||||
QMainWindow(parent), id(id), filePath(FilePath), cloneplot1D(nullptr), cloneplot2D(nullptr),
|
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), fileIndex(fIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
|
||||||
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), cloneBox(nullptr), lblHistTitle(nullptr) {
|
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), cloneBox(nullptr), lblHistTitle(nullptr) {
|
||||||
// Window title
|
// Window title
|
||||||
char winTitle[300], currTime[50];
|
char winTitle[300], currTime[50];
|
||||||
@ -123,9 +123,9 @@ void qCloneWidget::SetupWidgetWindow(QString title, QString xTitle, QString yTit
|
|||||||
resize(500, 350);
|
resize(500, 350);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qCloneWidget::SetCloneHists(int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers) {
|
void qCloneWidget::SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers) {
|
||||||
//for each plot, create hists
|
//for each plot, create hists
|
||||||
for (int hist_num = 0; hist_num < nHists; ++hist_num) {
|
for (unsigned int hist_num = 0; hist_num < nHists; ++hist_num) {
|
||||||
SlsQtH1D *k;
|
SlsQtH1D *k;
|
||||||
if (hist_num + 1 > cloneplot1D_hists.size()) {
|
if (hist_num + 1 > cloneplot1D_hists.size()) {
|
||||||
cloneplot1D_hists.append(k = new SlsQtH1D("1d plot", histNBins, histXAxis, histYAxis[hist_num]));
|
cloneplot1D_hists.append(k = new SlsQtH1D("1d plot", histNBins, histXAxis, histYAxis[hist_num]));
|
||||||
@ -213,13 +213,8 @@ void qCloneWidget::SavePlot() {
|
|||||||
char cID[10];
|
char cID[10];
|
||||||
sprintf(cID, "%d", id);
|
sprintf(cID, "%d", id);
|
||||||
//title
|
//title
|
||||||
QString fName = QString(filePath.c_str());
|
QString fName = filePath + Qstring('/') + fileName + Qstring('_') + imageIndex + Qstring('_') + QString(NowTime().c_str()) + QString(".png");
|
||||||
if (cloneBox->title().contains('.')) {
|
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||||
fName.append(QString('/') + cloneBox->title());
|
|
||||||
fName.replace(".dat", ".png");
|
|
||||||
fName.replace(".raw", ".png");
|
|
||||||
} else
|
|
||||||
fName.append(QString("/Snapshot_unknown_title.png"));
|
|
||||||
//save
|
//save
|
||||||
QImage img(cloneBox->size().width(), cloneBox->size().height(), QImage::Format_RGB32);
|
QImage img(cloneBox->size().width(), cloneBox->size().height(), QImage::Format_RGB32);
|
||||||
QPainter painter(&img);
|
QPainter painter(&img);
|
||||||
@ -243,13 +238,7 @@ int qCloneWidget::SavePlotAutomatic() {
|
|||||||
char cID[10];
|
char cID[10];
|
||||||
sprintf(cID, "%d", id);
|
sprintf(cID, "%d", id);
|
||||||
//title
|
//title
|
||||||
QString fName = QString(filePath.c_str());
|
QString fName = filePath + Qstring('/') + fileName + Qstring('_') + imageIndex + Qstring('_') + QString(NowTime().c_str()) + QString(".png");
|
||||||
if (cloneBox->title().contains('.')) {
|
|
||||||
fName.append(QString('/') + cloneBox->title());
|
|
||||||
fName.replace(".dat", ".png");
|
|
||||||
fName.replace(".raw", ".png");
|
|
||||||
} else
|
|
||||||
fName.append(QString("/Snapshot_unknown_title.png"));
|
|
||||||
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||||
//save
|
//save
|
||||||
QImage img(cloneBox->size().width(), cloneBox->size().height(), QImage::Format_RGB32);
|
QImage img(cloneBox->size().width(), cloneBox->size().height(), QImage::Format_RGB32);
|
||||||
|
@ -286,37 +286,31 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
|||||||
|
|
||||||
void qDetectorMain::Initialization() {
|
void qDetectorMain::Initialization() {
|
||||||
// Dockable Plot
|
// Dockable Plot
|
||||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool)));
|
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this, SLOT(ResizeMainWindow(bool)));
|
||||||
// tabs
|
// tabs
|
||||||
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||||
// Measurement tab
|
// Measurement tab
|
||||||
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
||||||
connect(tabMeasurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
|
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), tablPlot, SLOT(SetSaveFileName(QString)));
|
||||||
// Plot tab
|
// Plot tab
|
||||||
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
||||||
|
|
||||||
// Plotting
|
// Plotting
|
||||||
// When the acquisition is finished, must update the meas tab
|
// When the acquisition is finished, must update the meas tab
|
||||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
||||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tabMeasurement,
|
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tabMeasurement, SLOT(UpdateFinished()));
|
||||||
SLOT(UpdateFinished()));
|
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tabMeasurement, SLOT(SetCurrentMeasurement(int)));
|
||||||
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tabMeasurement,
|
|
||||||
SLOT(SetCurrentMeasurement(int)));
|
|
||||||
|
|
||||||
// menubar
|
// menubar
|
||||||
// Modes Menu
|
// Modes Menu
|
||||||
connect(menuModes, SIGNAL(triggered(QAction *)), this,
|
connect(menuModes, SIGNAL(triggered(QAction *)), this, SLOT(EnableModes(QAction *)));
|
||||||
SLOT(EnableModes(QAction *)));
|
|
||||||
// Utilities Menu
|
// Utilities Menu
|
||||||
connect(menuUtilities, SIGNAL(triggered(QAction *)), this,
|
connect(menuUtilities, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteUtilities(QAction *)));
|
||||||
SLOT(ExecuteUtilities(QAction *)));
|
|
||||||
// Help Menu
|
// Help Menu
|
||||||
connect(menuHelp, SIGNAL(triggered(QAction *)), this,
|
connect(menuHelp, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteHelp(QAction *)));
|
||||||
SLOT(ExecuteHelp(QAction *)));
|
|
||||||
|
|
||||||
// server
|
// server
|
||||||
connect(myServer, SIGNAL(ServerStoppedSignal()), this,
|
connect(myServer, SIGNAL(ServerStoppedSignal()), this, SLOT(UncheckServer()));
|
||||||
SLOT(UncheckServer()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDetectorMain::LoadConfigFile(const std::string fName) {
|
void qDetectorMain::LoadConfigFile(const std::string fName) {
|
||||||
@ -756,8 +750,6 @@ int qDetectorMain::StartStopAcquisitionFromClient(bool start) {
|
|||||||
if (start) {
|
if (start) {
|
||||||
if (tabMeasurement->GetStartStatus() != start) {
|
if (tabMeasurement->GetStartStatus() != start) {
|
||||||
tabMeasurement->ClentStartAcquisition();
|
tabMeasurement->ClentStartAcquisition();
|
||||||
while (myPlot->GetClientInitiated())
|
|
||||||
usleep(500);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tabMeasurement->StopAcquisition();
|
tabMeasurement->StopAcquisition();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,8 @@ bool qTabMeasurement::GetStartStatus(){
|
|||||||
void qTabMeasurement::ClentStartAcquisition(){
|
void qTabMeasurement::ClentStartAcquisition(){
|
||||||
StartAcquisition();
|
StartAcquisition();
|
||||||
myPlot->SetClientInitiated();
|
myPlot->SetClientInitiated();
|
||||||
|
while (myPlot->GetClientInitiated())
|
||||||
|
usleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qTabMeasurement::GetProgress(){
|
int qTabMeasurement::GetProgress(){
|
||||||
@ -502,11 +504,13 @@ void qTabMeasurement::GetFileName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::SetFileName() {
|
void qTabMeasurement::SetFileName() {
|
||||||
auto val = dispFileName->text().toAscii().constData();
|
std::string val = std::string(dispFileName->text().toAscii().constData());
|
||||||
FILE_LOG(logINFO) << "Setting File Name Prefix:" << val;
|
FILE_LOG(logINFO) << "Setting File Name Prefix:" << val;
|
||||||
try {
|
try {
|
||||||
myDet->setFileName(val);
|
myDet->setFileName(val);
|
||||||
} CATCH_HANDLE("Could not set file name prefix.", "qTabMeasurement::SetFileName", this, &qTabMeasurement::GetFileName)
|
} CATCH_HANDLE("Could not set file name prefix.", "qTabMeasurement::SetFileName", this, &qTabMeasurement::GetFileName)
|
||||||
|
|
||||||
|
emit FileNameChangedSignal(dispFileName->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::GetRunIndex() {
|
void qTabMeasurement::GetRunIndex() {
|
||||||
|
@ -20,7 +20,7 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
|||||||
|
|
||||||
|
|
||||||
qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) :
|
qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) :
|
||||||
QWidget(parent), myDet(detector), myPlot(plot), isOneD(false),
|
QWidget(parent), myDet(detector), myPlot(plot), is1d(false),
|
||||||
btnGroupPlotType(0), stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr) {
|
btnGroupPlotType(0), stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -92,10 +92,10 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
dispZAxis->setText(defaultImageZAxisTitle);
|
dispZAxis->setText(defaultImageZAxisTitle);
|
||||||
|
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
isOneD = false;
|
is1d = false;
|
||||||
switch(myDet->getDetectorTypeAsEnum()) {
|
switch(myDet->getDetectorTypeAsEnum()) {
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
isOneD = true;
|
is1d = true;
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
chkGapPixels->setEnabled(true);
|
chkGapPixels->setEnabled(true);
|
||||||
@ -108,7 +108,7 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Select1DPlot(isOneD);
|
Select1DPlot(is1d);
|
||||||
Initialization();
|
Initialization();
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
@ -134,13 +134,13 @@ void qTabPlot::Initialization() {
|
|||||||
connect(spinPersistency, SIGNAL(valueChanged(int)), myPlot, SLOT(SetPersistency(int)));
|
connect(spinPersistency, SIGNAL(valueChanged(int)), myPlot, SLOT(SetPersistency(int)));
|
||||||
connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool)));
|
connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool)));
|
||||||
connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool)));
|
connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool)));
|
||||||
connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogySignal(bool)));
|
connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SLOT(Set1dLogY(bool)));
|
||||||
connect(chkStatistics, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
|
connect(chkStatistics, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
|
||||||
|
|
||||||
// 2D Plot box
|
// 2D Plot box
|
||||||
connect(chkInterpolate, SIGNAL(toggled(bool)), myPlot, SIGNAL(InterpolateSignal(bool)));
|
connect(chkInterpolate, SIGNAL(toggled(bool)), myPlot, SLOT(SetInterpolate(bool)));
|
||||||
connect(chkContour, SIGNAL(toggled(bool)), myPlot, SIGNAL(ContourSignal(bool)));
|
connect(chkContour, SIGNAL(toggled(bool)), myPlot, SLOT(SetContour(bool)));
|
||||||
connect(chkLogz, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogzSignal(bool)));
|
connect(chkLogz, SIGNAL(toggled(bool)), myPlot, SLOT(SetLogz(bool)));
|
||||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
|
connect(chkStatistics_2, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
|
||||||
//pedstal
|
//pedstal
|
||||||
connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
|
connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
|
||||||
@ -161,7 +161,7 @@ void qTabPlot::Initialization() {
|
|||||||
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||||
//gainplot
|
//gainplot
|
||||||
if (chkGainPlot->isEnabled())
|
if (chkGainPlot->isEnabled())
|
||||||
connect(chkGainPlot, SIGNAL(toggled(bool)), myPlot, SIGNAL(GainPlotSignal(bool)));
|
connect(chkGainPlot, SIGNAL(toggled(bool)), myPlot, SLOT(EnableGainPlot(bool)));
|
||||||
// gap pixels
|
// gap pixels
|
||||||
if (chkGapPixels->isEnabled())
|
if (chkGapPixels->isEnabled())
|
||||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||||
@ -198,12 +198,11 @@ void qTabPlot::Initialization() {
|
|||||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||||
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||||
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||||
connect(this, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::Select1DPlot(bool enable) {
|
void qTabPlot::Select1DPlot(bool enable) {
|
||||||
FILE_LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
|
FILE_LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
|
||||||
isOneD = enable;
|
is1d = enable;
|
||||||
box1D->setEnabled(enable);
|
box1D->setEnabled(enable);
|
||||||
box2D->setEnabled(!enable);
|
box2D->setEnabled(!enable);
|
||||||
chkZAxis->setEnabled(!enable);
|
chkZAxis->setEnabled(!enable);
|
||||||
@ -212,14 +211,10 @@ void qTabPlot::Select1DPlot(bool enable) {
|
|||||||
chkZMax->setEnabled(!enable);
|
chkZMax->setEnabled(!enable);
|
||||||
dispZMin->setEnabled(!enable);
|
dispZMin->setEnabled(!enable);
|
||||||
dispZMax->setEnabled(!enable);
|
dispZMax->setEnabled(!enable);
|
||||||
if(enable) {
|
myplot->Select1dPlot(enable);
|
||||||
myPlot->Select1DPlot();
|
|
||||||
} else {
|
|
||||||
myPlot->Select2DPlot();
|
|
||||||
}
|
|
||||||
SetTitles();
|
SetTitles();
|
||||||
SetXYRange();
|
SetXYRange();
|
||||||
if (!isOneD) {
|
if (!is1d) {
|
||||||
SetZRange();
|
SetZRange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,7 +237,7 @@ void qTabPlot::SetPlot() {
|
|||||||
if (plotEnable) {
|
if (plotEnable) {
|
||||||
SetTitles();
|
SetTitles();
|
||||||
SetXYRange();
|
SetXYRange();
|
||||||
if (!isOneD) {
|
if (!is1d) {
|
||||||
SetZRange();
|
SetZRange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,7 +298,7 @@ void qTabPlot::EnablePersistency(bool enable) {
|
|||||||
void qTabPlot::SetBinary() {
|
void qTabPlot::SetBinary() {
|
||||||
bool binary1D = chkBinary->isChecked();
|
bool binary1D = chkBinary->isChecked();
|
||||||
bool binary2D = chkBinary_2->isChecked();
|
bool binary2D = chkBinary_2->isChecked();
|
||||||
if (isOneD) {
|
if (is1d) {
|
||||||
FILE_LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
|
FILE_LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
|
||||||
lblFrom->setEnabled(binary1D);
|
lblFrom->setEnabled(binary1D);
|
||||||
lblTo->setEnabled(binary1D);
|
lblTo->setEnabled(binary1D);
|
||||||
@ -364,15 +359,15 @@ void qTabPlot::SetTitles() {
|
|||||||
}
|
}
|
||||||
// x
|
// x
|
||||||
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
|
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
|
||||||
dispXAxis->setText(isOneD ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
dispXAxis->setText(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||||
myPlot->SetXAxisTitle(isOneD ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
myPlot->SetXAxisTitle(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||||
} else {
|
} else {
|
||||||
myPlot->SetXAxisTitle(dispXAxis->text());
|
myPlot->SetXAxisTitle(dispXAxis->text());
|
||||||
}
|
}
|
||||||
// y
|
// y
|
||||||
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
|
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
|
||||||
dispYAxis->setText(isOneD ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
dispYAxis->setText(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||||
myPlot->SetYAxisTitle(isOneD ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
myPlot->SetYAxisTitle(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||||
} else {
|
} else {
|
||||||
myPlot->SetYAxisTitle(dispYAxis->text());
|
myPlot->SetYAxisTitle(dispYAxis->text());
|
||||||
}
|
}
|
||||||
@ -490,7 +485,7 @@ void qTabPlot::SetXYRange() {
|
|||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||||
|
|
||||||
// to update plot with range
|
// to update plot with range
|
||||||
myPlot->SetXYRange(true);
|
myplot->SetXYRangeChanged();
|
||||||
myPlot->DisableZoom(disablezoom);
|
myPlot->DisableZoom(disablezoom);
|
||||||
emit DisableZoomSignal(disablezoom);
|
emit DisableZoomSignal(disablezoom);
|
||||||
}
|
}
|
||||||
@ -594,7 +589,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
myPlot->IsXYRangeValues(true, qDefs::YMAXIMUM);
|
myPlot->IsXYRangeValues(true, qDefs::YMAXIMUM);
|
||||||
|
|
||||||
// to update plot with range
|
// to update plot with range
|
||||||
myPlot->SetXYRange(true);
|
myplot->SetXYRangeChanged();
|
||||||
myPlot->DisableZoom(true);
|
myPlot->DisableZoom(true);
|
||||||
emit DisableZoomSignal(true);
|
emit DisableZoomSignal(true);
|
||||||
}
|
}
|
||||||
@ -609,7 +604,7 @@ void qTabPlot::SetZRange() {
|
|||||||
if (!dispZMax->text().isEmpty()) {
|
if (!dispZMax->text().isEmpty()) {
|
||||||
zmax = dispZMax->text().toDouble();
|
zmax = dispZMax->text().toDouble();
|
||||||
}
|
}
|
||||||
emit ResetZMinZMaxSignal(isZmin, isZmax, zmin, zmax);
|
myPlot->SetZRange(isZmin, isZmax, zmin, zmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::GetStreamingFrequency() {
|
void qTabPlot::GetStreamingFrequency() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user