1 #include "HistogramWidget.h" 
    9 #include <qwt_symbol.h> 
   10 #include <qwt_scale_div.h> 
   11 #include <qwt_plot_zoomer.h> 
   12 #include <qwt_scale_engine.h> 
   25     setCanvasBackground(Qt::white);
 
   26     enableAxis(QwtPlot::yRight);
 
   27     setAxisScale(QwtPlot::xBottom, 0, 255);
 
   28     setAxisLabelRotation(QwtPlot::xBottom, 45);
 
   29     setAxisScale(QwtPlot::yRight, 0, 255);
 
   33     axisFont.setBold(
true);
 
   34     axisTitle.setFont(axisFont);
 
   35     axisTitle.setText(
"Frequency");
 
   36     setAxisTitle(QwtPlot::yLeft, axisTitle);
 
   37     axisTitle.setText(
"Input (Cube DN)");
 
   38     setAxisTitle(QwtPlot::xBottom, axisTitle);
 
   39     axisTitle.setText(
"Output");
 
   40     setAxisTitle(QwtPlot::yRight, axisTitle);
 
   47     p_stretchCurve->setPen(QPen(QBrush(stretchColor), 2, Qt::DashLine));
 
   48     p_stretchCurve->setSymbol(
new QwtSymbol(QwtSymbol::Ellipse, QBrush(stretchColor), QPen(stretchColor), QSize(5, 5)));
 
   53     p_zoomer = 
new QwtPlotZoomer(canvas());
 
   64     std::vector<double> xarray, yarray;
 
   65     for(
int i = 0; i < hist.
Bins(); i++) {
 
   70         yarray.push_back(freq * 100.0);
 
   77     double maxYValue = DBL_MIN;
 
   78     double minYValue = DBL_MAX;
 
   81     for(
unsigned int y = 0; y < yarray.size(); y++) {
 
   82       intervals[y].interval = QwtInterval(xarray[y], xarray[y] + hist.
BinSize());
 
   84       intervals[y].value = yarray[y];
 
   85       if(yarray[y] > maxYValue)
 
   86         maxYValue = yarray[y];
 
   87       if(yarray[y] < minYValue)
 
   88         minYValue = yarray[y];
 
  101     QwtScaleEngine *engine = axisScaleEngine(QwtPlot::xBottom);
 
  102     QwtScaleDiv scale = engine->divideScale(min, max, maxMajor, maxMinor);
 
  103     QwtInterval interval = scale.interval();
 
  104     setAxisScale(QwtPlot::xBottom,
 
  105                  interval.minValue() - hist.
BinSize(),
 
  106                  interval.maxValue() + hist.
BinSize());
 
  117     for(
int i = 0; i < stretch.
Pairs(); i++) {
 
  118       curvePoints[i] = QPointF(stretch.
Input(i), stretch.
Output(i));
 
double Minimum() const 
Returns the absolute minimum double found in all data passed through the AddData method. 
 
int Bins() const 
Returns the number of bins in the histogram. 
 
BigInt BinCount(const int index) const 
Returns the count at a bin position in the histogram. 
 
void setColor(const QColor &)
Set the color of the hist. 
 
Container of a cube histogram. 
 
double Output(const int index) const 
Returns the value of the output side of the stretch pair at the specified index. 
 
This is the (qwt) plot item for a histogram. 
 
double Maximum() const 
Returns the absolute maximum double found in all data passed through the AddData method. 
 
double BinMiddle(const int index) const 
Returns the value represented by a bin. 
 
int Pairs() const 
Returns the number of stretch pairs. 
 
double Input(const int index) const 
Returns the value of the input side of the stretch pair at the specified index. 
 
double BinSize() const 
Returns the size of an individual bin. 
 
BigInt MaxBinCount() const 
Returns the highest bin count. 
 
void setData(const QwtIntervalSeriesData &data)
Overridden method to set the data in the histogram.