1 #include "SawtoothStretchType.h"
7 #include <QTableWidget>
10 #include "HistogramWidget.h"
24 const Stretch &stretch,
const QString &name,
const QColor &color) :
33 QGridLayout *sliderLayout =
new QGridLayout();
34 sliderLayout->setColumnStretch(1, 10);
36 QLabel *startLabel =
new QLabel(
"Offset");
49 connect(
p_offsetEdit, SIGNAL(textChanged(
const QString &)),
51 sliderLayout->addWidget(startLabel, 0, 0);
55 QLabel *widthLabel =
new QLabel(
"Width");
65 connect(
p_widthEdit, SIGNAL(textChanged(
const QString &)),
67 sliderLayout->addWidget(widthLabel, 1, 0);
71 sliderWidget->setLayout(sliderLayout);
107 bool changed =
false;
109 if(newStretch.
Pairs() < 3) {
118 offset = newStretch.
Input(1);
121 if(newStretch.
Output(1) > 127)
122 offset = newStretch.
Input(2);
124 width = (newStretch.
Input(2) - newStretch.
Input(0)) / 2;
128 double deltaOffset = fabs(
p_offsetEdit->text().toDouble() - offset);
131 double deltaWidth = fabs(
p_widthEdit->text().toDouble() - width);
179 int valuePos = (int)(percentage * 1000.0);
209 (highVal - lowVal) / 1000.0;
225 double percentage = value - lowVal;
226 percentage /= (highVal - lowVal);
227 int valuePos = (int)(percentage * 1000.0);
258 if(width < p_cubeHist->BinSize())
262 if(width <= 0)
return Stretch();
268 double leftPoint = offset;
271 while(leftPoint < p_cubeHist->Minimum() - width) {
282 double currPoint = leftPoint;
284 bool terminated =
false;
286 int outValue = (high) ? 255 : 0;