Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 1010:08f20a23fb81
Back out 1c37aa13bfd8 (which added half-wave rectification to colour 3d plot). Too specific.
author | Chris Cannam |
---|---|
date | Thu, 22 Oct 2015 11:40:17 +0100 |
parents | 1c37aa13bfd8 |
children | 7242fe160c19 19bb1744518e |
comparison
equal
deleted
inserted
replaced
1005:b247d3ffcbb9 | 1010:08f20a23fb81 |
---|---|
52 m_binScale(LinearBinScale), | 52 m_binScale(LinearBinScale), |
53 m_normalizeColumns(false), | 53 m_normalizeColumns(false), |
54 m_normalizeVisibleArea(false), | 54 m_normalizeVisibleArea(false), |
55 m_normalizeHybrid(false), | 55 m_normalizeHybrid(false), |
56 m_invertVertical(false), | 56 m_invertVertical(false), |
57 m_rectified(false), | |
58 m_opaque(false), | 57 m_opaque(false), |
59 m_smooth(false), | 58 m_smooth(false), |
60 m_peakResolution(256), | 59 m_peakResolution(256), |
61 m_miny(0), | 60 m_miny(0), |
62 m_maxy(0) | 61 m_maxy(0) |
161 list.push_back("Normalize Columns"); | 160 list.push_back("Normalize Columns"); |
162 list.push_back("Normalize Visible Area"); | 161 list.push_back("Normalize Visible Area"); |
163 list.push_back("Gain"); | 162 list.push_back("Gain"); |
164 list.push_back("Bin Scale"); | 163 list.push_back("Bin Scale"); |
165 list.push_back("Invert Vertical Scale"); | 164 list.push_back("Invert Vertical Scale"); |
166 list.push_back("Show Rectified"); | |
167 list.push_back("Opaque"); | 165 list.push_back("Opaque"); |
168 list.push_back("Smooth"); | 166 list.push_back("Smooth"); |
169 return list; | 167 return list; |
170 } | 168 } |
171 | 169 |
175 if (name == "Colour") return tr("Colour"); | 173 if (name == "Colour") return tr("Colour"); |
176 if (name == "Colour Scale") return tr("Scale"); | 174 if (name == "Colour Scale") return tr("Scale"); |
177 if (name == "Normalize Columns") return tr("Normalize Columns"); | 175 if (name == "Normalize Columns") return tr("Normalize Columns"); |
178 if (name == "Normalize Visible Area") return tr("Normalize Visible Area"); | 176 if (name == "Normalize Visible Area") return tr("Normalize Visible Area"); |
179 if (name == "Invert Vertical Scale") return tr("Invert Vertical Scale"); | 177 if (name == "Invert Vertical Scale") return tr("Invert Vertical Scale"); |
180 if (name == "Show Rectified") return tr("Half-Wave Rectify"); | |
181 if (name == "Gain") return tr("Gain"); | 178 if (name == "Gain") return tr("Gain"); |
182 if (name == "Opaque") return tr("Always Opaque"); | 179 if (name == "Opaque") return tr("Always Opaque"); |
183 if (name == "Smooth") return tr("Smooth"); | 180 if (name == "Smooth") return tr("Smooth"); |
184 if (name == "Bin Scale") return tr("Bin Scale"); | 181 if (name == "Bin Scale") return tr("Bin Scale"); |
185 return ""; | 182 return ""; |
189 Colour3DPlotLayer::getPropertyIconName(const PropertyName &name) const | 186 Colour3DPlotLayer::getPropertyIconName(const PropertyName &name) const |
190 { | 187 { |
191 if (name == "Normalize Columns") return "normalise-columns"; | 188 if (name == "Normalize Columns") return "normalise-columns"; |
192 if (name == "Normalize Visible Area") return "normalise"; | 189 if (name == "Normalize Visible Area") return "normalise"; |
193 if (name == "Invert Vertical Scale") return "invert-vertical"; | 190 if (name == "Invert Vertical Scale") return "invert-vertical"; |
194 if (name == "Show Rectified") return "derivative"; | |
195 if (name == "Opaque") return "opaque"; | 191 if (name == "Opaque") return "opaque"; |
196 if (name == "Smooth") return "smooth"; | 192 if (name == "Smooth") return "smooth"; |
197 return ""; | 193 return ""; |
198 } | 194 } |
199 | 195 |
202 { | 198 { |
203 if (name == "Gain") return RangeProperty; | 199 if (name == "Gain") return RangeProperty; |
204 if (name == "Normalize Columns") return ToggleProperty; | 200 if (name == "Normalize Columns") return ToggleProperty; |
205 if (name == "Normalize Visible Area") return ToggleProperty; | 201 if (name == "Normalize Visible Area") return ToggleProperty; |
206 if (name == "Invert Vertical Scale") return ToggleProperty; | 202 if (name == "Invert Vertical Scale") return ToggleProperty; |
207 if (name == "Show Rectified") return ToggleProperty; | |
208 if (name == "Opaque") return ToggleProperty; | 203 if (name == "Opaque") return ToggleProperty; |
209 if (name == "Smooth") return ToggleProperty; | 204 if (name == "Smooth") return ToggleProperty; |
210 return ValueProperty; | 205 return ValueProperty; |
211 } | 206 } |
212 | 207 |
214 Colour3DPlotLayer::getPropertyGroupName(const PropertyName &name) const | 209 Colour3DPlotLayer::getPropertyGroupName(const PropertyName &name) const |
215 { | 210 { |
216 if (name == "Normalize Columns" || | 211 if (name == "Normalize Columns" || |
217 name == "Normalize Visible Area" || | 212 name == "Normalize Visible Area" || |
218 name == "Colour Scale" || | 213 name == "Colour Scale" || |
219 name == "Show Rectified" || | |
220 name == "Gain") return tr("Scale"); | 214 name == "Gain") return tr("Scale"); |
221 if (name == "Bin Scale" || | 215 if (name == "Bin Scale" || |
222 name == "Invert Vertical Scale") return tr("Bins"); | 216 name == "Invert Vertical Scale") return tr("Bins"); |
223 if (name == "Opaque" || | 217 if (name == "Opaque" || |
224 name == "Smooth" || | 218 name == "Smooth" || |
278 | 272 |
279 } else if (name == "Invert Vertical Scale") { | 273 } else if (name == "Invert Vertical Scale") { |
280 | 274 |
281 *deflt = 0; | 275 *deflt = 0; |
282 val = (m_invertVertical ? 1 : 0); | 276 val = (m_invertVertical ? 1 : 0); |
283 | |
284 } else if (name == "Show Rectified") { | |
285 | |
286 if (min) *min = 0; | |
287 if (max) *max = 0; | |
288 if (deflt) *deflt = 0; | |
289 val = (m_rectified ? 1.0 : 0.0); | |
290 | 277 |
291 } else if (name == "Bin Scale") { | 278 } else if (name == "Bin Scale") { |
292 | 279 |
293 *min = 0; | 280 *min = 0; |
294 *max = 1; | 281 *max = 1; |
366 setNormalizeColumns(value ? true : false); | 353 setNormalizeColumns(value ? true : false); |
367 } else if (name == "Normalize Visible Area") { | 354 } else if (name == "Normalize Visible Area") { |
368 setNormalizeVisibleArea(value ? true : false); | 355 setNormalizeVisibleArea(value ? true : false); |
369 } else if (name == "Invert Vertical Scale") { | 356 } else if (name == "Invert Vertical Scale") { |
370 setInvertVertical(value ? true : false); | 357 setInvertVertical(value ? true : false); |
371 } else if (name == "Show Rectified") { | |
372 setShowRectified(value > 0.5); | |
373 } else if (name == "Opaque") { | 358 } else if (name == "Opaque") { |
374 setOpaque(value ? true : false); | 359 setOpaque(value ? true : false); |
375 } else if (name == "Smooth") { | 360 } else if (name == "Smooth") { |
376 setSmooth(value ? true : false); | 361 setSmooth(value ? true : false); |
377 } else if (name == "Bin Scale") { | 362 } else if (name == "Bin Scale") { |
480 void | 465 void |
481 Colour3DPlotLayer::setInvertVertical(bool n) | 466 Colour3DPlotLayer::setInvertVertical(bool n) |
482 { | 467 { |
483 if (m_invertVertical == n) return; | 468 if (m_invertVertical == n) return; |
484 m_invertVertical = n; | 469 m_invertVertical = n; |
485 cacheInvalid(); | |
486 emit layerParametersChanged(); | |
487 } | |
488 | |
489 void | |
490 Colour3DPlotLayer::setShowRectified(bool show) | |
491 { | |
492 if (m_rectified == show) return; | |
493 m_rectified = show; | |
494 cacheInvalid(); | 470 cacheInvalid(); |
495 emit layerParametersChanged(); | 471 emit layerParametersChanged(); |
496 } | 472 } |
497 | 473 |
498 void | 474 void |
952 DenseThreeDimensionalModel::Column | 928 DenseThreeDimensionalModel::Column |
953 Colour3DPlotLayer::getColumn(int col) const | 929 Colour3DPlotLayer::getColumn(int col) const |
954 { | 930 { |
955 Profiler profiler("Colour3DPlotLayer::getColumn"); | 931 Profiler profiler("Colour3DPlotLayer::getColumn"); |
956 | 932 |
957 DenseThreeDimensionalModel::Column prev; | |
958 if (m_rectified && (col > m_model->getStartFrame())) { | |
959 prev = m_model->getColumn(col - 1); | |
960 } | |
961 | |
962 DenseThreeDimensionalModel::Column values = m_model->getColumn(col); | 933 DenseThreeDimensionalModel::Column values = m_model->getColumn(col); |
963 | |
964 if (m_rectified && !prev.empty()) { | |
965 for (int y = 0; y < values.size(); ++y) { | |
966 if (values[y] < prev[y]) values[y] = 0; | |
967 else values[y] -= prev[y]; | |
968 } | |
969 } | |
970 | |
971 while (values.size() < m_model->getHeight()) values.push_back(0.f); | 934 while (values.size() < m_model->getHeight()) values.push_back(0.f); |
972 if (!m_normalizeColumns && !m_normalizeHybrid) return values; | 935 if (!m_normalizeColumns && !m_normalizeHybrid) return values; |
973 | 936 |
974 double colMax = 0.f, colMin = 0.f; | 937 double colMax = 0.f, colMin = 0.f; |
975 double min = 0.f, max = 0.f; | 938 double min = 0.f, max = 0.f; |