26 setCanvasBackground(Qt::white);
27 enableAxis(QwtPlot::yRight);
28 setAxisScale(QwtPlot::xBottom, 0, 255);
29 setAxisLabelRotation(QwtPlot::xBottom, 45);
30 setAxisScale(QwtPlot::yRight, 0, 255);
34 axisFont.setBold(
true);
35 axisTitle.setFont(axisFont);
36 axisTitle.setText(
"Frequency");
37 setAxisTitle(QwtPlot::yLeft, axisTitle);
38 axisTitle.setText(
"Input (Cube DN)");
39 setAxisTitle(QwtPlot::xBottom, axisTitle);
40 axisTitle.setText(
"Output");
41 setAxisTitle(QwtPlot::yRight, axisTitle);
48 p_stretchCurve->setPen(QPen(QBrush(stretchColor), 2, Qt::DashLine));
49 p_stretchCurve->setSymbol(
new QwtSymbol(QwtSymbol::Ellipse, QBrush(stretchColor), QPen(stretchColor), QSize(5, 5)));
54 p_zoomer =
new QwtPlotZoomer(canvas());
65 std::vector<double> xarray, yarray;
66 for(
int i = 0; i < hist.Bins(); i++) {
67 if(hist.BinCount(i) > 0) {
68 xarray.push_back(hist.BinMiddle(i));
70 double freq = (double)hist.BinCount(i) / (double)hist.MaxBinCount();
71 yarray.push_back(freq * 100.0);
77 QVector<QwtIntervalSample> intervals(xarray.size());
78 double maxYValue = DBL_MIN;
79 double minYValue = DBL_MAX;
82 for(
unsigned int y = 0; y < yarray.size(); y++) {
83 intervals[y].interval = QwtInterval(xarray[y], xarray[y] + hist.BinSize());
85 intervals[y].value = yarray[y];
86 if(yarray[y] > maxYValue)
87 maxYValue = yarray[y];
88 if(yarray[y] < minYValue)
89 minYValue = yarray[y];
96 double min = hist.Minimum();
97 double max = hist.Maximum();
102 QwtScaleEngine *engine = axisScaleEngine(QwtPlot::xBottom);
103 QwtScaleDiv scale = engine->divideScale(min, max, maxMajor, maxMinor);
104 QwtInterval interval = scale.interval();
105 setAxisScale(QwtPlot::xBottom,
106 interval.minValue() - hist.BinSize(),
107 interval.maxValue() + hist.BinSize());