Dhanya Thattil fcc7f7aef8
Rx roi (#428)
* roi structure expanded to have ymin and ymax

* compile with 'detector roi'

* wip

* wip, rx_roi, rx_clearroi

* wip rxroi

* rxroi wip

* wip rxroi

* merge fix

* wip

* rx_roi works, impl wip, test

* tests in, impl left

* wip, rxroi impl

* wip, rxroi impl

* wip

* setrx_Roi works, getrx_roi, wip

* rx_roi impl done

* wip, rxroi

* wip, getrx_roi rxr ports

* fix ports

* wip

* wip

* fix positions on server side

* wip

* numports wip

* wip

* jungfrau top inner interface row increment

* x, y detpos, wip

* removed eiger row indices flipping in gui (bottom flipping maintained)

* wip

* wip, jungfrau numinterfaces2

* jungfrau virtual works

* eiger, jungfrau, g2 virtual server works

* eiger positions fix, wip

* binaries in

* minor printout

* binaries in

* merge fix

* merge fix

* removing getposition

* setrxroi wip

* set upto port

* get messed, wip

* roi multi to module works, wip

* wip

* roi dont return -1

* added rxroi metadata in master file

* added rxroifromshm, not yet in detector

* rx roi in gui with box, also for gap pixels (gappixels for jungfrau mess)

* fix for segfault in gui with detaching roi box in gui

* wip

* m3 gui: slave timing modes should be discarded when squashing

* fixed m3 virtual data, and fixed counters in gui asthetics

* m3 roi works

* wip, g2

* wip

* handling g225um boards, and showing roi for gainplot as well

* udpate python functions

* fix for 1d and a2d roi written

* fixed actual roi written to file

* no virtual hdf5 when handling rx roi

* test

* minor

* binarie in
2022-05-16 12:35:06 +02:00

94 lines
3.4 KiB
C++

// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "SlsQt2DHist.h"
#include "SlsQt2DZoomer.h"
#include <qlist.h>
#include <qwt_plot.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_plot_shapeitem.h>
class QwtPlotPanner;
class QwtScaleWidget;
class QwtLinearColorMap;
class SlsQt2DPlot : public QwtPlot {
Q_OBJECT
public:
SlsQt2DPlot(QWidget * = NULL);
~SlsQt2DPlot();
void SetTitle(QString title);
void SetXTitle(QString title);
void SetYTitle(QString title);
void SetZTitle(QString title);
void SetTitleFont(const QFont &f);
void SetXFont(const QFont &f);
void SetYFont(const QFont &f);
void SetZFont(const QFont &f);
void UnZoom(bool replot = true);
void SetZoom(double xmin, double ymin, double x_width, double y_width);
void DisableZoom(bool disable);
void EnableXAutoScaling() { setAxisAutoScale(QwtPlot::xBottom, true); };
void EnableYAutoScaling() { setAxisAutoScale(QwtPlot::yLeft, true); };
void SetXMinMax(double min, double max) {
setAxisScale(QwtPlot::xBottom, min, max);
};
void SetYMinMax(double min, double max) {
setAxisScale(QwtPlot::yLeft, min, max);
};
double GetXMinimum() { return hist->GetXMin(); };
double GetXMaximum() { return hist->GetXMax(); };
double GetYMinimum() { return hist->GetYMin(); };
double GetYMaximum() { return hist->GetYMax(); };
double GetZMinimum() { return hist->GetMinimum(); }
double GetZMaximum() { return hist->GetMaximum(); }
void SetZMinMax(double zmin = 0, double zmax = -1);
void SetZMinimumToFirstGreaterThanZero() {
hist->SetMinimumToFirstGreaterThanZero();
}
double GetZMean() { return hist->GetMean(); }
void SetData(int nbinsx, double xmin, double xmax, int nbinsy, double ymin,
double ymax, double *d, double zmin = 0, double zmax = -1) {
hist->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d, zmin, zmax);
}
double *GetDataPtr() { return hist->GetDataPtr(); }
int GetBinIndex(int bx, int by) { return hist->GetBinIndex(bx, by); }
int FindBinIndex(double x, double y) { return hist->FindBinIndex(x, y); }
void SetBinValue(int bx, int by, double v) { hist->SetBinValue(bx, by, v); }
double GetBinValue(int bx, int by) { return hist->GetBinValue(bx, by); }
void FillTestPlot(int i = 0);
void Update();
void SetInterpolate(bool enable);
void SetContour(bool enable);
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
void SetZRange(bool isMin, bool isMax, double min, double max);
void LogZ(bool on = 1);
void EnableRoiBox(std::array<int, 4> roi);
void DisableRoiBox();
public slots:
void showSpectrogram(bool on);
private:
void SetupZoom();
void SetupColorMap();
QwtLinearColorMap *myColourMap(QVector<double> colourStops);
QwtLinearColorMap *myColourMap(int log = 0);
QwtPlotSpectrogram *d_spectrogram{nullptr};
SlsQt2DHist *hist{nullptr};
SlsQt2DZoomer *zoomer{nullptr};
QwtPlotPanner *panner{nullptr};
QwtScaleWidget *rightAxis{nullptr};
QList<double> contourLevelsLinear;
QList<double> contourLevelsLog;
bool disableZoom{false};
int isLog;
QwtPlotShapeItem *roiBox{nullptr};
};