comparison layer/Colour3DPlotLayer.cpp @ 1245:f0e291fa7b9c

Use Range01 normalisation in Colour 3D Plot. This gives us the same column normalisation behaviour as in 2.5 (better than the Max1 option).
author Chris Cannam
date Tue, 28 Feb 2017 14:06:24 +0000
parents 3ec95b7d1bfc
children f7ebb72c5e12
comparison
equal deleted inserted replaced
1244:3ec95b7d1bfc 1245:f0e291fa7b9c
105 Colour3DPlotLayer::convertToColumnNorm(int value) 105 Colour3DPlotLayer::convertToColumnNorm(int value)
106 { 106 {
107 switch (value) { 107 switch (value) {
108 default: 108 default:
109 case 0: return { ColumnNormalization::None, false }; 109 case 0: return { ColumnNormalization::None, false };
110 case 1: return { ColumnNormalization::Max1, false }; 110 case 1: return { ColumnNormalization::Range01, false };
111 case 2: return { ColumnNormalization::None, true }; // visible area 111 case 2: return { ColumnNormalization::None, true }; // visible area
112 case 3: return { ColumnNormalization::Hybrid, false }; 112 case 3: return { ColumnNormalization::Hybrid, false };
113 } 113 }
114 } 114 }
115 115
117 Colour3DPlotLayer::convertFromColumnNorm(ColumnNormalization norm, bool visible) 117 Colour3DPlotLayer::convertFromColumnNorm(ColumnNormalization norm, bool visible)
118 { 118 {
119 if (visible) return 2; 119 if (visible) return 2;
120 switch (norm) { 120 switch (norm) {
121 case ColumnNormalization::None: return 0; 121 case ColumnNormalization::None: return 0;
122 case ColumnNormalization::Max1: return 1; 122 case ColumnNormalization::Range01: return 1;
123 case ColumnNormalization::Hybrid: return 3; 123 case ColumnNormalization::Hybrid: return 3;
124 124
125 case ColumnNormalization::Sum1: 125 case ColumnNormalization::Sum1:
126 case ColumnNormalization::Max1:
126 default: return 0; 127 default: return 0;
127 } 128 }
128 } 129 }
129 130
130 void 131 void
1061 double maxValue = 1.0; 1062 double maxValue = 1.0;
1062 1063
1063 if (m_normalizeVisibleArea && m_viewMags[viewId].isSet()) { 1064 if (m_normalizeVisibleArea && m_viewMags[viewId].isSet()) {
1064 minValue = m_viewMags[viewId].getMin(); 1065 minValue = m_viewMags[viewId].getMin();
1065 maxValue = m_viewMags[viewId].getMax(); 1066 maxValue = m_viewMags[viewId].getMax();
1067 } else if (m_normalization == ColumnNormalization::Hybrid) {
1068 minValue = 0;
1069 maxValue = log10(m_model->getMaximumLevel() + 1.0);
1066 } else if (m_normalization == ColumnNormalization::None) { 1070 } else if (m_normalization == ColumnNormalization::None) {
1067 minValue = m_model->getMinimumLevel(); 1071 minValue = m_model->getMinimumLevel();
1068 maxValue = m_model->getMaximumLevel(); 1072 maxValue = m_model->getMaximumLevel();
1069 } else if (m_normalization == ColumnNormalization::Hybrid) {
1070 minValue = 0;
1071 maxValue = log10(m_model->getMaximumLevel() + 1.0);
1072 } 1073 }
1073 1074
1074 SVDEBUG << "Colour3DPlotLayer: rebuilding renderer, value range is " 1075 SVDEBUG << "Colour3DPlotLayer: rebuilding renderer, value range is "
1075 << minValue << " -> " << maxValue << endl; 1076 << minValue << " -> " << maxValue << endl;
1076 1077
1236 // normalization in future: write out the column normalization 1237 // normalization in future: write out the column normalization
1237 // type separately, and then whether we are normalizing visible 1238 // type separately, and then whether we are normalizing visible
1238 // area as well afterwards 1239 // area as well afterwards
1239 1240
1240 s += QString("columnNormalization=\"%1\" ") 1241 s += QString("columnNormalization=\"%1\" ")
1241 .arg(m_normalization == ColumnNormalization::Max1 ? "peak" : 1242 .arg(m_normalization == ColumnNormalization::Range01 ? "peak" :
1242 m_normalization == ColumnNormalization::Hybrid ? "hybrid" : "none"); 1243 m_normalization == ColumnNormalization::Hybrid ? "hybrid" : "none");
1243 1244
1244 // Old-style normalization attribute, for backward compatibility 1245 // Old-style normalization attribute, for backward compatibility
1245 1246
1246 s += QString("normalizeColumns=\"%1\" ") 1247 s += QString("normalizeColumns=\"%1\" ")
1247 .arg(m_normalization == ColumnNormalization::Max1 ? "true" : "false"); 1248 .arg(m_normalization == ColumnNormalization::Range01 ? "true" : "false");
1248 1249
1249 // And this applies to both old- and new-style attributes 1250 // And this applies to both old- and new-style attributes
1250 1251
1251 s += QString("normalizeVisibleArea=\"%1\" ") 1252 s += QString("normalizeVisibleArea=\"%1\" ")
1252 .arg(m_normalizeVisibleArea ? "true" : "false"); 1253 .arg(m_normalizeVisibleArea ? "true" : "false");
1296 if (columnNormalization != "") { 1297 if (columnNormalization != "") {
1297 1298
1298 haveNewStyleNormalization = true; 1299 haveNewStyleNormalization = true;
1299 1300
1300 if (columnNormalization == "peak") { 1301 if (columnNormalization == "peak") {
1301 setNormalization(ColumnNormalization::Max1); 1302 setNormalization(ColumnNormalization::Range01);
1302 } else if (columnNormalization == "hybrid") { 1303 } else if (columnNormalization == "hybrid") {
1303 setNormalization(ColumnNormalization::Hybrid); 1304 setNormalization(ColumnNormalization::Hybrid);
1304 } else if (columnNormalization == "none") { 1305 } else if (columnNormalization == "none") {
1305 setNormalization(ColumnNormalization::None); 1306 setNormalization(ColumnNormalization::None);
1306 } else { 1307 } else {
1314 setNormalization(ColumnNormalization::None); 1315 setNormalization(ColumnNormalization::None);
1315 1316
1316 bool normalizeColumns = 1317 bool normalizeColumns =
1317 (attributes.value("normalizeColumns").trimmed() == "true"); 1318 (attributes.value("normalizeColumns").trimmed() == "true");
1318 if (normalizeColumns) { 1319 if (normalizeColumns) {
1319 setNormalization(ColumnNormalization::Max1); 1320 setNormalization(ColumnNormalization::Range01);
1320 } 1321 }
1321 1322
1322 bool normalizeHybrid = 1323 bool normalizeHybrid =
1323 (attributes.value("normalizeHybrid").trimmed() == "true"); 1324 (attributes.value("normalizeHybrid").trimmed() == "true");
1324 if (normalizeHybrid) { 1325 if (normalizeHybrid) {