# HG changeset patch # User Chris Cannam # Date 1470315776 -3600 # Node ID 998e31e92dbe50c61478701b5f6e14c1dabce31f # Parent 4e7ed3252d805ae03d83e5db192b1608d74eb962 Restore phase display diff -r 4e7ed3252d80 -r 998e31e92dbe layer/Colour3DPlotRenderer.cpp --- a/layer/Colour3DPlotRenderer.cpp Thu Aug 04 11:26:11 2016 +0100 +++ b/layer/Colour3DPlotRenderer.cpp Thu Aug 04 14:02:56 2016 +0100 @@ -292,6 +292,41 @@ } } +ColumnOp::Column +Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins) const +{ + // order: + // get column -> scale -> normalise -> record extents -> + // peak pick -> distribute/interpolate -> apply display gain + + // we do the first bit here: + // get column -> scale -> normalise + + ColumnOp::Column column; + + if (m_params.colourScale.getScale() == ColourScaleType::Phase && + m_sources.fft) { + + ColumnOp::Column fullColumn = m_sources.fft->getPhases(sx); + + column = vector(fullColumn.data() + minbin, + fullColumn.data() + minbin + nbins); + + } else { + + ColumnOp::Column fullColumn = m_sources.source->getColumn(sx); + + 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; +} + MagnitudeRange Colour3DPlotRenderer::renderDirectTranslucent(const LayerGeometryProvider *v, QPainter &paint, @@ -351,23 +386,12 @@ if (sx != psx) { - //!!! this is in common with renderDrawBuffer - pull it out + // order: + // get column -> scale -> normalise -> record extents -> + // peak pick -> distribute/interpolate -> apply display gain - // order: - // get column -> scale -> record extents -> - // normalise -> peak pick -> apply display gain - - ColumnOp::Column fullColumn = model->getColumn(sx); - - ColumnOp::Column column = - vector(fullColumn.data() + minbin, - fullColumn.data() + minbin + nbins); - - column = ColumnOp::applyGain(column, m_params.scaleFactor); - -// if (m_colourScale != ColourScaleType::Phase) { - preparedColumn = ColumnOp::normalize(column, m_params.normalization); -// } + // this does the first three: + preparedColumn = getColumn(sx, minbin, nbins); magRange.sample(preparedColumn); @@ -784,29 +808,16 @@ } if (sx != psx) { + + // order: + // get column -> scale -> normalise -> record extents -> + // peak pick -> distribute/interpolate -> apply display gain - // order: - // get column -> scale -> record extents -> - // normalise -> peak pick -> distribute/interpolate -> - // apply display gain - - ColumnOp::Column fullColumn = sourceModel->getColumn(sx); - -// cerr << "x " << x << ", sx " << sx << ", col height " << fullColumn.size() -// << ", minbin " << minbin << ", nbins " << nbins << endl; - - ColumnOp::Column column = - vector(fullColumn.data() + minbin, - fullColumn.data() + minbin + nbins); - - column = ColumnOp::applyGain(column, m_params.scaleFactor); - -// if (m_colourScale != ColourScaleType::Phase) { - column = ColumnOp::normalize(column, m_params.normalization); -// } + // this does the first three: + ColumnOp::Column column = getColumn(sx, minbin, nbins); magRange.sample(column); - + if (m_params.binDisplay == BinDisplay::PeakBins) { column = ColumnOp::peakPick(column); } @@ -943,22 +954,8 @@ } if (sx != psx) { - - ColumnOp::Column fullColumn = fft->getColumn(sx); - - ColumnOp::Column column = - vector(fullColumn.data() + minbin, - fullColumn.data() + minbin + nbins + 1); - - column = ColumnOp::applyGain(column, m_params.scaleFactor); - -//!!! if (m_colourScale != ColourScaleType::Phase) { - preparedColumn = ColumnOp::normalize - (column, m_params.normalization); -//!!! } - + preparedColumn = getColumn(sx, minbin, nbins); magRange.sample(preparedColumn); - psx = sx; } diff -r 4e7ed3252d80 -r 998e31e92dbe layer/Colour3DPlotRenderer.h --- a/layer/Colour3DPlotRenderer.h Thu Aug 04 11:26:11 2016 +0100 +++ b/layer/Colour3DPlotRenderer.h Thu Aug 04 14:02:56 2016 +0100 @@ -294,6 +294,8 @@ }; RenderType decideRenderType(const LayerGeometryProvider *) const; + + ColumnOp::Column getColumn(int sx, int minbin, int nbins) const; }; #endif diff -r 4e7ed3252d80 -r 998e31e92dbe layer/ColourScale.cpp --- a/layer/ColourScale.cpp Thu Aug 04 11:26:11 2016 +0100 +++ b/layer/ColourScale.cpp Thu Aug 04 14:02:56 2016 +0100 @@ -88,7 +88,8 @@ if (m_params.scaleType == ColourScaleType::Phase) { double half = (maxPixF - 1.f) / 2.f; - return 1 + int((value * half) / M_PI + half); + int pixel = 1 + int((value * half) / M_PI + half); + return pixel; } value *= m_params.gain;