# HG changeset patch # User Chris Cannam # Date 1540913521 0 # Node ID 7d28e7522dbdee2f8ce61ddb9c458de276567473 # Parent bbeffb29bf0927f7befa24f2fa4ca715251258e5 Add show-derivative option but, like inverting the colour scale, I don't think it's as useful as I'd hoped diff -r bbeffb29bf09 -r 7d28e7522dbd layer/Colour3DPlotRenderer.cpp --- a/layer/Colour3DPlotRenderer.cpp Tue Oct 30 14:00:20 2018 +0000 +++ b/layer/Colour3DPlotRenderer.cpp Tue Oct 30 15:32:01 2018 +0000 @@ -353,8 +353,6 @@ Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins, int peakCacheIndex) const { - Profiler profiler("Colour3DPlotRenderer::getColumn"); - // order: // get column -> scale -> normalise -> record extents -> // peak pick -> distribute/interpolate -> apply display gain @@ -363,7 +361,38 @@ // get column -> scale -> normalise ColumnOp::Column column; - + + if (m_params.showDerivative && sx > 0) { + + auto prev = getColumnRaw(sx - 1, minbin, nbins, peakCacheIndex); + column = getColumnRaw(sx, minbin, nbins, peakCacheIndex); + + for (int i = 0; i < nbins; ++i) { + column[i] -= prev[i]; + } + + } else { + column = getColumnRaw(sx, minbin, nbins, peakCacheIndex); + } + + if (m_params.colourScale.getScale() == ColourScaleType::Phase && + m_sources.fft) { + return column; + } else { + column = ColumnOp::applyGain(column, m_params.scaleFactor); + column = ColumnOp::normalize(column, m_params.normalization); + return column; + } +} + +ColumnOp::Column +Colour3DPlotRenderer::getColumnRaw(int sx, int minbin, int nbins, + int peakCacheIndex) const +{ + Profiler profiler("Colour3DPlotRenderer::getColumn"); + + ColumnOp::Column column; + if (m_params.colourScale.getScale() == ColourScaleType::Phase && m_sources.fft) { @@ -382,10 +411,6 @@ column = vector(fullColumn.data() + minbin, fullColumn.data() + minbin + nbins); - - column = ColumnOp::applyGain(column, m_params.scaleFactor); - - column = ColumnOp::normalize(column, m_params.normalization); } return column; diff -r bbeffb29bf09 -r 7d28e7522dbd layer/Colour3DPlotRenderer.h --- a/layer/Colour3DPlotRenderer.h Tue Oct 30 14:00:20 2018 +0000 +++ b/layer/Colour3DPlotRenderer.h Tue Oct 30 15:32:01 2018 +0000 @@ -67,6 +67,7 @@ alwaysOpaque(false), interpolate(false), invertVertical(false), + showDerivative(false), scaleFactor(1.0), colourRotation(0) { } @@ -100,6 +101,10 @@ /** Whether to render the whole caboodle upside-down. */ bool invertVertical; + /** Whether to show the frame-to-frame difference instead of + * the actual value */ + bool showDerivative; + /** Initial scale factor (e.g. for FFT scaling). This factor * is applied to all values read from the underlying model * *before* magnitude ranges are calculated, in contrast to @@ -319,6 +324,8 @@ ColumnOp::Column getColumn(int sx, int minbin, int nbins, int peakCacheIndex) const; // -1 => don't use cache + ColumnOp::Column getColumnRaw(int sx, int minbin, int nbins, + int peakCacheIndex) const; // -1 => don't use cache void getPreferredPeakCache(const LayerGeometryProvider *, int &peakCacheIndex, int &binsPerPeak) const;