1 #include "BinaryStretchType.h"
7 #include <QTableWidget>
10 #include "HistogramWidget.h"
25 const QString &name,
const QColor &color)
35 QGridLayout *sliderLayout =
new QGridLayout();
36 sliderLayout->setColumnStretch(1, 10);
38 QLabel *startLabel =
new QLabel(
"Start");
49 connect(
p_startEdit, SIGNAL(textChanged(
const QString &)),
51 sliderLayout->addWidget(startLabel, 0, 0);
55 QLabel *endLabel =
new QLabel(
"End");
67 connect(
p_endEdit, SIGNAL(textChanged(
const QString &)),
69 sliderLayout->addWidget(endLabel, 1, 0);
73 sliderWidget->setLayout(sliderLayout);
104 double switch1 = 0.0;
105 double switch2 = 1.0;
107 if(newStretch.
Pairs() == 2) {
118 switch1 = newStretch.
Input(0);
119 if(switch1 < p_cubeHist->Minimum())
122 interpretted.
AddPair(switch1, 0);
123 interpretted.
AddPair(switch1 + epsilon, 255);
125 switch2 = newStretch.
Input(1);
126 if(switch2 <= switch1 + epsilon)
127 switch2 = switch1 + epsilon + epsilon;
129 interpretted.
AddPair(switch2, 255);
130 interpretted.
AddPair(switch2 + epsilon, 0);
133 if(end <= switch2 + epsilon)
134 end = switch2 + epsilon + epsilon;
139 else if(newStretch.
Pairs() == 4) {
140 if(newStretch.
Output(0) > 127) {
143 switch1 = newStretch.
Input(1);
144 if(switch1 <= p_cubeHist->Minimum())
147 interpretted.
AddPair(switch1, 255);
148 interpretted.
AddPair(switch1 + epsilon, 0);
151 if(end <= switch1 + epsilon)
152 end = switch1 + epsilon + epsilon;
161 switch1 = newStretch.
Input(1);
162 if(switch1 < p_cubeHist->Minimum())
165 interpretted.
AddPair(switch1, 0);
166 interpretted.
AddPair(switch1 + epsilon, 255);
169 if(end <= switch1 + epsilon)
170 end = switch1 + epsilon + epsilon;
173 interpretted.
AddPair(end, 255);
177 else if(newStretch.
Pairs() == 6) {
180 switch1 = newStretch.
Input(1);
181 if(switch1 <= p_cubeHist->Minimum())
184 interpretted.
AddPair(switch1, 0);
185 interpretted.
AddPair(switch1 + epsilon, 255);
188 switch2 = newStretch.
Input(3);
189 if(switch2 <= switch1 + epsilon)
190 switch2 = switch1 + epsilon + epsilon;
192 interpretted.
AddPair(switch2, 255);
193 interpretted.
AddPair(switch2 + epsilon, 0);
196 if(end <= switch2 + epsilon)
197 end = switch2 + epsilon + epsilon;
202 if(!interpretted.
Pairs()) {
214 p_endEdit->setText(QString::number(switch2));
255 if(value >=
p_endEdit->text().toDouble()) {
261 int valuePos = (int)(percentage * 1000.0);
294 p_endEdit->setText(QString::number(value));
303 double value =
p_endEdit->text().toDouble();
305 if(value <= p_startEdit->text().
toDouble()) {
311 int valuePos = (int)(percentage * 1000.0);
349 startPt <= p_cubeHist->Minimum()) {
355 newStretch.
AddPair(startPt, 0);
356 newStretch.
AddPair(startPt + epsilon, 255);
360 double endPt =
p_endEdit->text().toDouble();
361 if(endPt <= startPt + epsilon) {
362 endPt = startPt + 2 * epsilon;
370 newStretch.
AddPair(endPt, 255);
371 newStretch.
AddPair(endPt + epsilon, 0);