comparison layer/Colour3DPlotLayer.cpp @ 743:a352fb986e7b tony_integration

Merge from branch tonioni
author Chris Cannam
date Tue, 11 Mar 2014 17:33:19 +0000
parents 67e6d518ac27
children c27a3604fe6f
comparison
equal deleted inserted replaced
718:e5f4385615ac 743:a352fb986e7b
49 m_colourMap(0), 49 m_colourMap(0),
50 m_gain(1.0), 50 m_gain(1.0),
51 m_binScale(LinearBinScale), 51 m_binScale(LinearBinScale),
52 m_normalizeColumns(false), 52 m_normalizeColumns(false),
53 m_normalizeVisibleArea(false), 53 m_normalizeVisibleArea(false),
54 m_normalizeHybrid(false),
54 m_invertVertical(false), 55 m_invertVertical(false),
55 m_opaque(false), 56 m_opaque(false),
56 m_smooth(false), 57 m_smooth(false),
57 m_miny(0), 58 m_miny(0),
58 m_maxy(0) 59 m_maxy(0)
428 { 429 {
429 return m_normalizeColumns; 430 return m_normalizeColumns;
430 } 431 }
431 432
432 void 433 void
434 Colour3DPlotLayer::setNormalizeHybrid(bool n)
435 {
436 if (m_normalizeHybrid == n) return;
437 m_normalizeHybrid = n;
438 cacheInvalid();
439 emit layerParametersChanged();
440 }
441
442 bool
443 Colour3DPlotLayer::getNormalizeHybrid() const
444 {
445 return m_normalizeHybrid;
446 }
447
448 void
433 Colour3DPlotLayer::setNormalizeVisibleArea(bool n) 449 Colour3DPlotLayer::setNormalizeVisibleArea(bool n)
434 { 450 {
435 if (m_normalizeVisibleArea == n) return; 451 if (m_normalizeVisibleArea == n) return;
436 m_normalizeVisibleArea = n; 452 m_normalizeVisibleArea = n;
437 cacheInvalid(); 453 cacheInvalid();
880 DenseThreeDimensionalModel::Column 896 DenseThreeDimensionalModel::Column
881 Colour3DPlotLayer::getColumn(size_t col) const 897 Colour3DPlotLayer::getColumn(size_t col) const
882 { 898 {
883 DenseThreeDimensionalModel::Column values = m_model->getColumn(col); 899 DenseThreeDimensionalModel::Column values = m_model->getColumn(col);
884 while (values.size() < m_model->getHeight()) values.push_back(0.f); 900 while (values.size() < m_model->getHeight()) values.push_back(0.f);
885 if (!m_normalizeColumns) return values; 901 if (!m_normalizeColumns && !m_normalizeHybrid) return values;
886 902
887 float colMax = 0.f, colMin = 0.f; 903 float colMax = 0.f, colMin = 0.f;
888 float min = 0.f, max = 0.f; 904 float min = 0.f, max = 0.f;
889 905
890 min = m_model->getMinimumLevel(); 906 min = m_model->getMinimumLevel();
901 float value = values.at(y); 917 float value = values.at(y);
902 float norm = (value - colMin) / (colMax - colMin); 918 float norm = (value - colMin) / (colMax - colMin);
903 float newvalue = min + (max - min) * norm; 919 float newvalue = min + (max - min) * norm;
904 920
905 if (value != newvalue) values[y] = newvalue; 921 if (value != newvalue) values[y] = newvalue;
922 }
923
924 if (m_normalizeHybrid && (colMax > 0.0)) {
925 float logmax = log10(colMax);
926 for (size_t y = 0; y < values.size(); ++y) {
927 values[y] *= logmax;
928 }
906 } 929 }
907 930
908 return values; 931 return values;
909 } 932 }
910 933