1#include "LinearStretchType.h"
9#include "CubeViewport.h"
10#include "HistogramWidget.h"
11#include "Statistics.h"
13#include "CubeStretch.h"
26 const QString &name,
const QColor &color)
36 QGridLayout *sliderLayout =
new QGridLayout();
37 sliderLayout->setColumnStretch(1, 10);
39 QLabel *minHistLabel =
new QLabel(
"Min DN");
49 connect(
p_startEdit, SIGNAL(textChanged(
const QString &)),
51 sliderLayout->addWidget(minHistLabel, 0, 0);
55 QLabel *maxHistLabel =
new QLabel(
"Max DN");
66 connect(
p_endEdit, SIGNAL(textChanged(
const QString &)),
68 sliderLayout->addWidget(maxHistLabel, 1, 0);
72 sliderWidget->setLayout(sliderLayout);
102 if(newStretch.Pairs() >= 2) {
103 double inMin = newStretch.
Input(0);
104 double inMax = newStretch.Input(1);
112 interpretted.AddPair(inMin, 0);
113 interpretted.AddPair(inMax, 255);
125 if (inMin == inMax) {
130 interpretted.AddPair(inMin, 0);
131 interpretted.AddPair(inMax, 255);
150 emit stretchChanged();
182 if(value >=
p_endEdit->text().toDouble()) {
188 int valuePos = (int)(percentage * 1000.0);
202 emit stretchChanged();
223 p_endEdit->setText(QString::number(value));
232 double value =
p_endEdit->text().toDouble();
234 if(value <= p_startEdit->text().
toDouble()) {
240 int valuePos = (int)(percentage * 1000.0);
250 newStretch.AddPair(value, 255);
254 emit stretchChanged();
Stores stretch information for a cube.
Container of a cube histogram.
double BinSize() const
Returns the size of an individual bin.
bool p_editOverride
This is used to let the edits be changed without updating the stretch.
virtual CubeStretch getStretch()
Returns the CubeStretch for this LinearStretch.
void startSliderMoved(int)
This is called when the start point slider moves.
virtual void setStretch(Stretch)
Given an arbitrary stretch, this will re-interpret it, as best as possible, into a linear stretch.
QLineEdit * p_startEdit
Line start pt edit.
void endEditChanged(const QString &)
A new end point was typed in.
~LinearStretchType()
Destructor.
QLineEdit * p_endEdit
Line end pt edit.
void endSliderMoved(int)
This is called when the end point slider moves.
void startEditChanged(const QString &)
A new start point was typed in.
LinearStretchType(const Histogram &, const Stretch &, const QString &name, const QColor &color)
This constructs a linear stretch type.
QSlider * p_endSlider
Line end pt slider.
QSlider * p_startSlider
Line start pt slider.
bool p_sliderOverride
This is used to let the edits be changed to where sliders cant go.
double Minimum() const
Returns the absolute minimum double found in all data passed through the AddData method.
double BestMinimum(const double percent=99.5) const
This method returns the better of the absolute minimum or the Chebyshev minimum.
double BestMaximum(const double percent=99.5) const
This method returns the better of the absolute maximum or the Chebyshev maximum.
double Maximum() const
Returns the absolute maximum double found in all data passed through the AddData method.
void CopyPairs(const Stretch &other)
Copies the stretch pairs from another Stretch object, but maintains special pixel values.
void AddPair(const double input, const double output)
Adds a stretch pair to the list of pairs.
double Input(const int index) const
Returns the value of the input side of the stretch pair at the specified index.
QString Text() const
Converts stretch pair to a string.
This is the base class for advanced stretches.
Stretch * p_stretch
Current stretch pairs stored here.
Histogram * p_cubeHist
Visible area histogram.
QGridLayout * p_mainLayout
Main layout.
This is free and unencumbered software released into the public domain.
double toDouble(const QString &string)
Global function to convert from a string to a double.