Mercurial > hg > svgui
diff layer/Colour3DPlotLayer.cpp @ 719:67e6d518ac27
Bodge in Matthias's suggested normalise-to-log as an option in spectrogram and colour 3d plot layers (not wired into gui)
author | Chris Cannam |
---|---|
date | Tue, 28 Jan 2014 17:37:42 +0000 |
parents | 1a0dfcbffaf1 |
children | c27a3604fe6f |
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp Wed Dec 04 14:00:27 2013 +0000 +++ b/layer/Colour3DPlotLayer.cpp Tue Jan 28 17:37:42 2014 +0000 @@ -51,6 +51,7 @@ m_binScale(LinearBinScale), m_normalizeColumns(false), m_normalizeVisibleArea(false), + m_normalizeHybrid(false), m_invertVertical(false), m_opaque(false), m_smooth(false), @@ -430,6 +431,21 @@ } void +Colour3DPlotLayer::setNormalizeHybrid(bool n) +{ + if (m_normalizeHybrid == n) return; + m_normalizeHybrid = n; + cacheInvalid(); + emit layerParametersChanged(); +} + +bool +Colour3DPlotLayer::getNormalizeHybrid() const +{ + return m_normalizeHybrid; +} + +void Colour3DPlotLayer::setNormalizeVisibleArea(bool n) { if (m_normalizeVisibleArea == n) return; @@ -882,7 +898,7 @@ { DenseThreeDimensionalModel::Column values = m_model->getColumn(col); while (values.size() < m_model->getHeight()) values.push_back(0.f); - if (!m_normalizeColumns) return values; + if (!m_normalizeColumns && !m_normalizeHybrid) return values; float colMax = 0.f, colMin = 0.f; float min = 0.f, max = 0.f; @@ -905,6 +921,13 @@ if (value != newvalue) values[y] = newvalue; } + if (m_normalizeHybrid && (colMax > 0.0)) { + float logmax = log10(colMax); + for (size_t y = 0; y < values.size(); ++y) { + values[y] *= logmax; + } + } + return values; }