comparison layer/Colour3DPlotRenderer.cpp @ 1364:7d28e7522dbd

Add show-derivative option but, like inverting the colour scale, I don't think it's as useful as I'd hoped
author Chris Cannam
date Tue, 30 Oct 2018 15:32:01 +0000
parents d79e21855aef
children 79032214f79d
comparison
equal deleted inserted replaced
1363:bbeffb29bf09 1364:7d28e7522dbd
351 351
352 ColumnOp::Column 352 ColumnOp::Column
353 Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins, 353 Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins,
354 int peakCacheIndex) const 354 int peakCacheIndex) const
355 { 355 {
356 Profiler profiler("Colour3DPlotRenderer::getColumn");
357
358 // order: 356 // order:
359 // get column -> scale -> normalise -> record extents -> 357 // get column -> scale -> normalise -> record extents ->
360 // peak pick -> distribute/interpolate -> apply display gain 358 // peak pick -> distribute/interpolate -> apply display gain
361 359
362 // we do the first bit here: 360 // we do the first bit here:
363 // get column -> scale -> normalise 361 // get column -> scale -> normalise
364 362
365 ColumnOp::Column column; 363 ColumnOp::Column column;
366 364
365 if (m_params.showDerivative && sx > 0) {
366
367 auto prev = getColumnRaw(sx - 1, minbin, nbins, peakCacheIndex);
368 column = getColumnRaw(sx, minbin, nbins, peakCacheIndex);
369
370 for (int i = 0; i < nbins; ++i) {
371 column[i] -= prev[i];
372 }
373
374 } else {
375 column = getColumnRaw(sx, minbin, nbins, peakCacheIndex);
376 }
377
378 if (m_params.colourScale.getScale() == ColourScaleType::Phase &&
379 m_sources.fft) {
380 return column;
381 } else {
382 column = ColumnOp::applyGain(column, m_params.scaleFactor);
383 column = ColumnOp::normalize(column, m_params.normalization);
384 return column;
385 }
386 }
387
388 ColumnOp::Column
389 Colour3DPlotRenderer::getColumnRaw(int sx, int minbin, int nbins,
390 int peakCacheIndex) const
391 {
392 Profiler profiler("Colour3DPlotRenderer::getColumn");
393
394 ColumnOp::Column column;
395
367 if (m_params.colourScale.getScale() == ColourScaleType::Phase && 396 if (m_params.colourScale.getScale() == ColourScaleType::Phase &&
368 m_sources.fft) { 397 m_sources.fft) {
369 398
370 ColumnOp::Column fullColumn = m_sources.fft->getPhases(sx); 399 ColumnOp::Column fullColumn = m_sources.fft->getPhases(sx);
371 400
380 m_sources.source) 409 m_sources.source)
381 ->getColumn(sx); 410 ->getColumn(sx);
382 411
383 column = vector<float>(fullColumn.data() + minbin, 412 column = vector<float>(fullColumn.data() + minbin,
384 fullColumn.data() + minbin + nbins); 413 fullColumn.data() + minbin + nbins);
385
386 column = ColumnOp::applyGain(column, m_params.scaleFactor);
387
388 column = ColumnOp::normalize(column, m_params.normalization);
389 } 414 }
390 415
391 return column; 416 return column;
392 } 417 }
393 418