Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.cpp @ 1138:998e31e92dbe spectrogram-minor-refactor
Restore phase display
author | Chris Cannam |
---|---|
date | Thu, 04 Aug 2016 14:02:56 +0100 |
parents | 9ff838a64461 |
children | 2976f57164ac |
comparison
equal
deleted
inserted
replaced
1137:4e7ed3252d80 | 1138:998e31e92dbe |
---|---|
290 } else { | 290 } else { |
291 return DrawBufferPixelResolution; | 291 return DrawBufferPixelResolution; |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 ColumnOp::Column | |
296 Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins) const | |
297 { | |
298 // order: | |
299 // get column -> scale -> normalise -> record extents -> | |
300 // peak pick -> distribute/interpolate -> apply display gain | |
301 | |
302 // we do the first bit here: | |
303 // get column -> scale -> normalise | |
304 | |
305 ColumnOp::Column column; | |
306 | |
307 if (m_params.colourScale.getScale() == ColourScaleType::Phase && | |
308 m_sources.fft) { | |
309 | |
310 ColumnOp::Column fullColumn = m_sources.fft->getPhases(sx); | |
311 | |
312 column = vector<float>(fullColumn.data() + minbin, | |
313 fullColumn.data() + minbin + nbins); | |
314 | |
315 } else { | |
316 | |
317 ColumnOp::Column fullColumn = m_sources.source->getColumn(sx); | |
318 | |
319 column = vector<float>(fullColumn.data() + minbin, | |
320 fullColumn.data() + minbin + nbins); | |
321 | |
322 column = ColumnOp::applyGain(column, m_params.scaleFactor); | |
323 | |
324 column = ColumnOp::normalize(column, m_params.normalization); | |
325 } | |
326 | |
327 return column; | |
328 } | |
329 | |
295 MagnitudeRange | 330 MagnitudeRange |
296 Colour3DPlotRenderer::renderDirectTranslucent(const LayerGeometryProvider *v, | 331 Colour3DPlotRenderer::renderDirectTranslucent(const LayerGeometryProvider *v, |
297 QPainter &paint, | 332 QPainter &paint, |
298 QRect rect) | 333 QRect rect) |
299 { | 334 { |
349 continue; | 384 continue; |
350 } | 385 } |
351 | 386 |
352 if (sx != psx) { | 387 if (sx != psx) { |
353 | 388 |
354 //!!! this is in common with renderDrawBuffer - pull it out | |
355 | |
356 // order: | 389 // order: |
357 // get column -> scale -> record extents -> | 390 // get column -> scale -> normalise -> record extents -> |
358 // normalise -> peak pick -> apply display gain | 391 // peak pick -> distribute/interpolate -> apply display gain |
359 | 392 |
360 ColumnOp::Column fullColumn = model->getColumn(sx); | 393 // this does the first three: |
361 | 394 preparedColumn = getColumn(sx, minbin, nbins); |
362 ColumnOp::Column column = | |
363 vector<float>(fullColumn.data() + minbin, | |
364 fullColumn.data() + minbin + nbins); | |
365 | |
366 column = ColumnOp::applyGain(column, m_params.scaleFactor); | |
367 | |
368 // if (m_colourScale != ColourScaleType::Phase) { | |
369 preparedColumn = ColumnOp::normalize(column, m_params.normalization); | |
370 // } | |
371 | 395 |
372 magRange.sample(preparedColumn); | 396 magRange.sample(preparedColumn); |
373 | 397 |
374 if (m_params.binDisplay == BinDisplay::PeakBins) { | 398 if (m_params.binDisplay == BinDisplay::PeakBins) { |
375 preparedColumn = ColumnOp::peakPick(preparedColumn); | 399 preparedColumn = ColumnOp::peakPick(preparedColumn); |
782 if (sx < 0 || sx >= modelWidth) { | 806 if (sx < 0 || sx >= modelWidth) { |
783 continue; | 807 continue; |
784 } | 808 } |
785 | 809 |
786 if (sx != psx) { | 810 if (sx != psx) { |
787 | 811 |
788 // order: | 812 // order: |
789 // get column -> scale -> record extents -> | 813 // get column -> scale -> normalise -> record extents -> |
790 // normalise -> peak pick -> distribute/interpolate -> | 814 // peak pick -> distribute/interpolate -> apply display gain |
791 // apply display gain | 815 |
792 | 816 // this does the first three: |
793 ColumnOp::Column fullColumn = sourceModel->getColumn(sx); | 817 ColumnOp::Column column = getColumn(sx, minbin, nbins); |
794 | 818 |
795 // cerr << "x " << x << ", sx " << sx << ", col height " << fullColumn.size() | 819 magRange.sample(column); |
796 // << ", minbin " << minbin << ", nbins " << nbins << endl; | |
797 | 820 |
798 ColumnOp::Column column = | |
799 vector<float>(fullColumn.data() + minbin, | |
800 fullColumn.data() + minbin + nbins); | |
801 | |
802 column = ColumnOp::applyGain(column, m_params.scaleFactor); | |
803 | |
804 // if (m_colourScale != ColourScaleType::Phase) { | |
805 column = ColumnOp::normalize(column, m_params.normalization); | |
806 // } | |
807 | |
808 magRange.sample(column); | |
809 | |
810 if (m_params.binDisplay == BinDisplay::PeakBins) { | 821 if (m_params.binDisplay == BinDisplay::PeakBins) { |
811 column = ColumnOp::peakPick(column); | 822 column = ColumnOp::peakPick(column); |
812 } | 823 } |
813 | 824 |
814 preparedColumn = | 825 preparedColumn = |
941 if (sx < 0 || sx >= modelWidth) { | 952 if (sx < 0 || sx >= modelWidth) { |
942 continue; | 953 continue; |
943 } | 954 } |
944 | 955 |
945 if (sx != psx) { | 956 if (sx != psx) { |
946 | 957 preparedColumn = getColumn(sx, minbin, nbins); |
947 ColumnOp::Column fullColumn = fft->getColumn(sx); | |
948 | |
949 ColumnOp::Column column = | |
950 vector<float>(fullColumn.data() + minbin, | |
951 fullColumn.data() + minbin + nbins + 1); | |
952 | |
953 column = ColumnOp::applyGain(column, m_params.scaleFactor); | |
954 | |
955 //!!! if (m_colourScale != ColourScaleType::Phase) { | |
956 preparedColumn = ColumnOp::normalize | |
957 (column, m_params.normalization); | |
958 //!!! } | |
959 | |
960 magRange.sample(preparedColumn); | 958 magRange.sample(preparedColumn); |
961 | |
962 psx = sx; | 959 psx = sx; |
963 } | 960 } |
964 | 961 |
965 if (sx == sx0) { | 962 if (sx == sx0) { |
966 pixelPeakColumn = preparedColumn; | 963 pixelPeakColumn = preparedColumn; |