mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
gainplot clone revised
This commit is contained in:
@ -11,10 +11,10 @@
|
||||
|
||||
int qCloneWidget::NumClones{0};
|
||||
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt2DPlot* gp,
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt1DPlot *gp1, SlsQt2DPlot* gp,
|
||||
QString title, QString fPath, QString fName, int64_t aIndex,
|
||||
bool displayStats, QString min, QString max, QString sum):
|
||||
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||
setupUi(this);
|
||||
id = qCloneWidget::NumClones++;
|
||||
SetupWidgetWindow(title);
|
||||
@ -26,6 +26,8 @@ qCloneWidget::~qCloneWidget() {
|
||||
delete plot1d;
|
||||
if (plot2d)
|
||||
delete plot2d;
|
||||
if (gainplot1d)
|
||||
delete gainplot1d;
|
||||
if (gainplot2d)
|
||||
delete gainplot2d;
|
||||
}
|
||||
@ -40,7 +42,13 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||
|
||||
// 1d
|
||||
if (plot1d != nullptr) {
|
||||
plotLayout->addWidget(plot1d);
|
||||
if (gainplot1d == nullptr) {
|
||||
plotLayout->addWidget(plot1d);
|
||||
} else {
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
// 2d
|
||||
else {
|
||||
@ -92,6 +100,10 @@ void qCloneWidget::SavePlot() {
|
||||
}
|
||||
|
||||
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
||||
if (gainplot1d != nullptr) {
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
if (gainplot2d != nullptr) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
|
@ -193,7 +193,7 @@ void qDrawPlot::SetupPlots() {
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
gainplot1d->setAxisScaleDiv( QwtPlot::yLeft, div );
|
||||
gainplot1d->setAxisScaleDiv( QwtPlot::yLeft, div);
|
||||
//gainplot1d->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtScaleDraw::Ticks, false);
|
||||
//gainplot1d->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtScaleDraw::Labels, false);
|
||||
gainhist1d->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
@ -244,7 +244,7 @@ void qDrawPlot::SetupPlots() {
|
||||
//gainplot2d->enableAxis(1, false);
|
||||
gainplot2d->enableAxis(QwtPlot::xBottom, false);
|
||||
// set ticks to just 3
|
||||
gainplot2d->setAxisScaleDiv( QwtPlot::yRight, div );
|
||||
gainplot2d->setAxisScaleDiv( QwtPlot::yRight, div);
|
||||
gainplot2d->hide();
|
||||
|
||||
// layout of plots
|
||||
@ -495,6 +495,7 @@ void qDrawPlot::ClonePlot() {
|
||||
|
||||
SlsQt1DPlot* cloneplot1D = nullptr;
|
||||
SlsQt2DPlot* cloneplot2D = nullptr;
|
||||
SlsQt1DPlot* clonegainplot1D = nullptr;
|
||||
SlsQt2DPlot* clonegainplot2D = nullptr;
|
||||
|
||||
if (is1d) {
|
||||
@ -516,6 +517,24 @@ void qDrawPlot::ClonePlot() {
|
||||
cloneplotHists1D.append(h);
|
||||
h->Attach(cloneplot1D);
|
||||
}
|
||||
if (isGainDataExtracted) {
|
||||
SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, gainDatay1d);
|
||||
h->SetLineColor(0);
|
||||
h->setStyleLinesorDots(isLines);
|
||||
h->setSymbolMarkers(isMarkers);
|
||||
h->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
clonegainplot1D = new SlsQt1DPlot();
|
||||
clonegainplot1D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetTitle("");
|
||||
clonegainplot1D->SetYTitle("Gain");
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
clonegainplot1D->setAxisScaleDiv( QwtPlot::yLeft, div);
|
||||
h->Attach(clonegainplot1D);
|
||||
|
||||
}
|
||||
} else {
|
||||
FILE_LOG(logDEBUG) << "Cloning 2D Image";
|
||||
cloneplot2D = new SlsQt2DPlot();
|
||||
@ -533,19 +552,31 @@ void qDrawPlot::ClonePlot() {
|
||||
|
||||
if (isGainDataExtracted) {
|
||||
clonegainplot2D = new SlsQt2DPlot();
|
||||
clonegainplot2D->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot2D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot2D->SetTitle("Gain");
|
||||
clonegainplot2D->SetZTitle("");
|
||||
clonegainplot2D->enableAxis(QwtPlot::yLeft, false);
|
||||
clonegainplot2D->enableAxis(QwtPlot::xBottom, false);
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
clonegainplot2D->setAxisScaleDiv( QwtPlot::yRight, div);
|
||||
|
||||
clonegainplot2D->enableAxis(0, false);
|
||||
clonegainplot2D->enableAxis(1, false);
|
||||
clonegainplot2D->enableAxis(2, false);
|
||||
clonegainplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
clonegainplot2D->SetTitle("");
|
||||
}
|
||||
}
|
||||
|
||||
qCloneWidget* q = new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot2D,
|
||||
boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex,
|
||||
qCloneWidget* q = new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot1D,
|
||||
clonegainplot2D, boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex,
|
||||
displayStatistics, lblMinDisp->text(), lblMaxDisp->text(), lblSumDisp->text());
|
||||
q->show();
|
||||
q->show();
|
||||
if (clonegainplot1D != nullptr) {
|
||||
clonegainplot1D->setFixedWidth(cloneplot1D->width());
|
||||
//clonegainplot1D->setFixedHeight(cloneplot1D->height());// / qDefs::DATA_GAIN_PLOT_RATIO - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void qDrawPlot::SavePlot() {
|
||||
|
Reference in New Issue
Block a user