comparison layer/SpectrogramLayer.cpp @ 862:1986c9b0d9c3 normalize_hybrid_option

Experimentally add the hybrid normalisation as an option (not working well either in UI or implementation)
author Chris Cannam
date Fri, 12 Sep 2014 11:38:55 +0100
parents d7f6f60a8b30
children 98827470ada2
comparison
equal deleted inserted replaced
861:59a22f3bf86d 862:1986c9b0d9c3
71 m_initialMaxFrequency(8000), 71 m_initialMaxFrequency(8000),
72 m_colourScale(dBColourScale), 72 m_colourScale(dBColourScale),
73 m_colourMap(0), 73 m_colourMap(0),
74 m_frequencyScale(LinearFrequencyScale), 74 m_frequencyScale(LinearFrequencyScale),
75 m_binDisplay(AllBins), 75 m_binDisplay(AllBins),
76 m_normalizeColumns(false), 76 m_normalization(NoNormalization),
77 m_normalizeVisibleArea(false),
78 m_normalizeHybrid(false),
79 m_lastEmittedZoomStep(-1), 77 m_lastEmittedZoomStep(-1),
80 m_synchronous(false), 78 m_synchronous(false),
81 m_haveDetailedScale(false), 79 m_haveDetailedScale(false),
82 m_lastPaintBlockWidth(0), 80 m_lastPaintBlockWidth(0),
83 m_updateTimer(0), 81 m_updateTimer(0),
105 setMaxFrequency(2000); 103 setMaxFrequency(2000);
106 setMinFrequency(40); 104 setMinFrequency(40);
107 setFrequencyScale(LogFrequencyScale); 105 setFrequencyScale(LogFrequencyScale);
108 setColourScale(LinearColourScale); 106 setColourScale(LinearColourScale);
109 setBinDisplay(PeakFrequencies); 107 setBinDisplay(PeakFrequencies);
110 setNormalizeColumns(true); 108 setNormalization(NormalizeColumns);
111 } 109 }
112 110
113 Preferences *prefs = Preferences::getInstance(); 111 Preferences *prefs = Preferences::getInstance();
114 connect(prefs, SIGNAL(propertyChanged(PropertyContainer::PropertyName)), 112 connect(prefs, SIGNAL(propertyChanged(PropertyContainer::PropertyName)),
115 this, SLOT(preferenceChanged(PropertyContainer::PropertyName))); 113 this, SLOT(preferenceChanged(PropertyContainer::PropertyName)));
153 PropertyList list; 151 PropertyList list;
154 list.push_back("Colour"); 152 list.push_back("Colour");
155 list.push_back("Colour Scale"); 153 list.push_back("Colour Scale");
156 list.push_back("Window Size"); 154 list.push_back("Window Size");
157 list.push_back("Window Increment"); 155 list.push_back("Window Increment");
158 list.push_back("Normalize Columns"); 156 list.push_back("Normalization");
159 list.push_back("Normalize Visible Area");
160 list.push_back("Bin Display"); 157 list.push_back("Bin Display");
161 list.push_back("Threshold"); 158 list.push_back("Threshold");
162 list.push_back("Gain"); 159 list.push_back("Gain");
163 list.push_back("Colour Rotation"); 160 list.push_back("Colour Rotation");
164 // list.push_back("Min Frequency"); 161 // list.push_back("Min Frequency");
173 { 170 {
174 if (name == "Colour") return tr("Colour"); 171 if (name == "Colour") return tr("Colour");
175 if (name == "Colour Scale") return tr("Colour Scale"); 172 if (name == "Colour Scale") return tr("Colour Scale");
176 if (name == "Window Size") return tr("Window Size"); 173 if (name == "Window Size") return tr("Window Size");
177 if (name == "Window Increment") return tr("Window Overlap"); 174 if (name == "Window Increment") return tr("Window Overlap");
178 if (name == "Normalize Columns") return tr("Normalize Columns"); 175 if (name == "Normalization") return tr("Normalization");
179 if (name == "Normalize Visible Area") return tr("Normalize Visible Area");
180 if (name == "Bin Display") return tr("Bin Display"); 176 if (name == "Bin Display") return tr("Bin Display");
181 if (name == "Threshold") return tr("Threshold"); 177 if (name == "Threshold") return tr("Threshold");
182 if (name == "Gain") return tr("Gain"); 178 if (name == "Gain") return tr("Gain");
183 if (name == "Colour Rotation") return tr("Colour Rotation"); 179 if (name == "Colour Rotation") return tr("Colour Rotation");
184 if (name == "Min Frequency") return tr("Min Frequency"); 180 if (name == "Min Frequency") return tr("Min Frequency");
187 if (name == "Zero Padding") return tr("Smoothing"); 183 if (name == "Zero Padding") return tr("Smoothing");
188 return ""; 184 return "";
189 } 185 }
190 186
191 QString 187 QString
192 SpectrogramLayer::getPropertyIconName(const PropertyName &name) const 188 SpectrogramLayer::getPropertyIconName(const PropertyName &) const
193 { 189 {
194 if (name == "Normalize Columns") return "normalise-columns";
195 if (name == "Normalize Visible Area") return "normalise";
196 return ""; 190 return "";
197 } 191 }
198 192
199 Layer::PropertyType 193 Layer::PropertyType
200 SpectrogramLayer::getPropertyType(const PropertyName &name) const 194 SpectrogramLayer::getPropertyType(const PropertyName &name) const
201 { 195 {
202 if (name == "Gain") return RangeProperty; 196 if (name == "Gain") return RangeProperty;
203 if (name == "Colour Rotation") return RangeProperty; 197 if (name == "Colour Rotation") return RangeProperty;
204 if (name == "Normalize Columns") return ToggleProperty;
205 if (name == "Normalize Visible Area") return ToggleProperty;
206 if (name == "Threshold") return RangeProperty; 198 if (name == "Threshold") return RangeProperty;
207 if (name == "Zero Padding") return ToggleProperty; 199 if (name == "Zero Padding") return ToggleProperty;
208 return ValueProperty; 200 return ValueProperty;
209 } 201 }
210 202
217 name == "Window Increment" || 209 name == "Window Increment" ||
218 name == "Zero Padding") return tr("Window"); 210 name == "Zero Padding") return tr("Window");
219 if (name == "Colour" || 211 if (name == "Colour" ||
220 name == "Threshold" || 212 name == "Threshold" ||
221 name == "Colour Rotation") return tr("Colour"); 213 name == "Colour Rotation") return tr("Colour");
222 if (name == "Normalize Columns" || 214 if (name == "Normalization" ||
223 name == "Normalize Visible Area" ||
224 name == "Gain" || 215 name == "Gain" ||
225 name == "Colour Scale") return tr("Scale"); 216 name == "Colour Scale") return tr("Scale");
226 return QString(); 217 return QString();
227 } 218 }
228 219
363 *min = 0; 354 *min = 0;
364 *max = 2; 355 *max = 2;
365 *deflt = int(AllBins); 356 *deflt = int(AllBins);
366 val = (int)m_binDisplay; 357 val = (int)m_binDisplay;
367 358
368 } else if (name == "Normalize Columns") { 359 } else if (name == "Normalization") {
369 360
370 *deflt = 0; 361 *min = 0;
371 val = (m_normalizeColumns ? 1 : 0); 362 *max = 3;
372 363 *deflt = int(NoNormalization);
373 } else if (name == "Normalize Visible Area") { 364 val = (int)m_normalization;
374
375 *deflt = 0;
376 val = (m_normalizeVisibleArea ? 1 : 0);
377 365
378 } else { 366 } else {
379 val = Layer::getPropertyRangeAndValue(name, min, max, deflt); 367 val = Layer::getPropertyRangeAndValue(name, min, max, deflt);
380 } 368 }
381 369
396 case 1: return tr("Meter"); 384 case 1: return tr("Meter");
397 case 2: return tr("dBV^2"); 385 case 2: return tr("dBV^2");
398 case 3: return tr("dBV"); 386 case 3: return tr("dBV");
399 case 4: return tr("Phase"); 387 case 4: return tr("Phase");
400 } 388 }
389 }
390 if (name == "Normalization") {
391 return ""; // icon only
401 } 392 }
402 if (name == "Window Size") { 393 if (name == "Window Size") {
403 return QString("%1").arg(32 << value); 394 return QString("%1").arg(32 << value);
404 } 395 }
405 if (name == "Window Increment") { 396 if (name == "Window Increment") {
461 case 1: return tr("Peak Bins"); 452 case 1: return tr("Peak Bins");
462 case 2: return tr("Frequencies"); 453 case 2: return tr("Frequencies");
463 } 454 }
464 } 455 }
465 return tr("<unknown>"); 456 return tr("<unknown>");
457 }
458
459 QString
460 SpectrogramLayer::getPropertyValueIconName(const PropertyName &name,
461 int value) const
462 {
463 if (name == "Normalization") {
464 switch(value) {
465 default:
466 case 0: return "normalise-none";
467 case 1: return "normalise-columns";
468 case 2: return "normalise";
469 case 3: return "normalise-hybrid";
470 }
471 }
472 return "";
466 } 473 }
467 474
468 RangeMapper * 475 RangeMapper *
469 SpectrogramLayer::getNewPropertyRangeMapper(const PropertyName &name) const 476 SpectrogramLayer::getNewPropertyRangeMapper(const PropertyName &name) const
470 { 477 {
553 default: 560 default:
554 case 0: setBinDisplay(AllBins); break; 561 case 0: setBinDisplay(AllBins); break;
555 case 1: setBinDisplay(PeakBins); break; 562 case 1: setBinDisplay(PeakBins); break;
556 case 2: setBinDisplay(PeakFrequencies); break; 563 case 2: setBinDisplay(PeakFrequencies); break;
557 } 564 }
558 } else if (name == "Normalize Columns") { 565 } else if (name == "Normalization") {
559 setNormalizeColumns(value ? true : false); 566 switch (value) {
560 } else if (name == "Normalize Visible Area") { 567 default:
561 setNormalizeVisibleArea(value ? true : false); 568 case 0: setNormalization(NoNormalization); break;
569 case 1: setNormalization(NormalizeColumns); break;
570 case 2: setNormalization(NormalizeVisibleArea); break;
571 case 3: setNormalization(NormalizeHybrid); break;
572 }
562 } 573 }
563 } 574 }
564 575
565 void 576 void
566 SpectrogramLayer::invalidateImageCaches() 577 SpectrogramLayer::invalidateImageCaches()
932 { 943 {
933 return m_binDisplay; 944 return m_binDisplay;
934 } 945 }
935 946
936 void 947 void
937 SpectrogramLayer::setNormalizeColumns(bool n) 948 SpectrogramLayer::setNormalization(Normalization n)
938 { 949 {
939 if (m_normalizeColumns == n) return; 950 if (m_normalization == n) return;
940 951
941 invalidateImageCaches(); 952 invalidateImageCaches();
942 invalidateMagnitudes(); 953 invalidateMagnitudes();
943 m_normalizeColumns = n; 954 m_normalization = n;
944 955
945 emit layerParametersChanged(); 956 emit layerParametersChanged();
946 } 957 }
947 958
948 bool 959 SpectrogramLayer::Normalization
949 SpectrogramLayer::getNormalizeColumns() const 960 SpectrogramLayer::getNormalization() const
950 { 961 {
951 return m_normalizeColumns; 962 return m_normalization;
952 }
953
954 void
955 SpectrogramLayer::setNormalizeHybrid(bool n)
956 {
957 if (m_normalizeHybrid == n) return;
958
959 invalidateImageCaches();
960 invalidateMagnitudes();
961 m_normalizeHybrid = n;
962
963 emit layerParametersChanged();
964 }
965
966 bool
967 SpectrogramLayer::getNormalizeHybrid() const
968 {
969 return m_normalizeHybrid;
970 }
971
972 void
973 SpectrogramLayer::setNormalizeVisibleArea(bool n)
974 {
975 SVDEBUG << "SpectrogramLayer::setNormalizeVisibleArea(" << n
976 << ") (from " << m_normalizeVisibleArea << ")" << endl;
977
978 if (m_normalizeVisibleArea == n) return;
979
980 invalidateImageCaches();
981 invalidateMagnitudes();
982 m_normalizeVisibleArea = n;
983
984 emit layerParametersChanged();
985 }
986
987 bool
988 SpectrogramLayer::getNormalizeVisibleArea() const
989 {
990 return m_normalizeVisibleArea;
991 } 963 }
992 964
993 void 965 void
994 SpectrogramLayer::setLayerDormant(const View *v, bool dormant) 966 SpectrogramLayer::setLayerDormant(const View *v, bool dormant)
995 { 967 {
1186 int value; 1158 int value;
1187 1159
1188 float min = 0.f; 1160 float min = 0.f;
1189 float max = 1.f; 1161 float max = 1.f;
1190 1162
1191 if (m_normalizeVisibleArea) { 1163 if (m_normalization == NormalizeVisibleArea) {
1192 min = m_viewMags[v].getMin(); 1164 min = m_viewMags[v].getMin();
1193 max = m_viewMags[v].getMax(); 1165 max = m_viewMags[v].getMax();
1194 } else if (!m_normalizeColumns) { 1166 } else if (m_normalization != NormalizeColumns) {
1195 if (m_colourScale == LinearColourScale //|| 1167 if (m_colourScale == LinearColourScale //||
1196 // m_colourScale == MeterColourScale) { 1168 // m_colourScale == MeterColourScale) {
1197 ) { 1169 ) {
1198 max = 0.1f; 1170 max = 0.1f;
1199 } 1171 }
1963 1935
1964 if (updateViewMagnitudes(v)) { 1936 if (updateViewMagnitudes(v)) {
1965 #ifdef DEBUG_SPECTROGRAM_REPAINT 1937 #ifdef DEBUG_SPECTROGRAM_REPAINT
1966 cerr << "SpectrogramLayer: magnitude range changed to [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << endl; 1938 cerr << "SpectrogramLayer: magnitude range changed to [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << endl;
1967 #endif 1939 #endif
1968 if (m_normalizeVisibleArea) { 1940 if (m_normalization == NormalizeVisibleArea) {
1969 cache.validArea = QRect(); 1941 cache.validArea = QRect();
1970 recreateWholeImageCache = true; 1942 recreateWholeImageCache = true;
1971 } 1943 }
1972 } else { 1944 } else {
1973 #ifdef DEBUG_SPECTROGRAM_REPAINT 1945 #ifdef DEBUG_SPECTROGRAM_REPAINT
2402 cache.startFrame = startFrame; 2374 cache.startFrame = startFrame;
2403 cache.zoomLevel = zoomLevel; 2375 cache.zoomLevel = zoomLevel;
2404 2376
2405 if (!m_synchronous) { 2377 if (!m_synchronous) {
2406 2378
2407 if (!m_normalizeVisibleArea || !overallMagChanged) { 2379 if ((m_normalization != NormalizeVisibleArea) || !overallMagChanged) {
2408 2380
2409 if (cache.validArea.x() > 0) { 2381 if (cache.validArea.x() > 0) {
2410 #ifdef DEBUG_SPECTROGRAM_REPAINT 2382 #ifdef DEBUG_SPECTROGRAM_REPAINT
2411 SVDEBUG << "SpectrogramLayer::paint() updating left (0, " 2383 SVDEBUG << "SpectrogramLayer::paint() updating left (0, "
2412 << cache.validArea.x() << ")" << endl; 2384 << cache.validArea.x() << ")" << endl;
2516 if (sx != psx) { 2488 if (sx != psx) {
2517 peakfreqs = fft->getPeakFrequencies(FFTModel::AllPeaks, sx, 2489 peakfreqs = fft->getPeakFrequencies(FFTModel::AllPeaks, sx,
2518 minbin, maxbin - 1); 2490 minbin, maxbin - 1);
2519 if (m_colourScale == PhaseColourScale) { 2491 if (m_colourScale == PhaseColourScale) {
2520 fft->getPhasesAt(sx, values, minbin, maxbin - minbin + 1); 2492 fft->getPhasesAt(sx, values, minbin, maxbin - minbin + 1);
2521 } else if (m_normalizeColumns) { 2493 } else if (m_normalization == NormalizeColumns) {
2522 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); 2494 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1);
2523 } else if (m_normalizeHybrid) { 2495 } else if (m_normalization == NormalizeHybrid) {
2524 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1); 2496 fft->getNormalizedMagnitudesAt(sx, values, minbin, maxbin - minbin + 1);
2525 float max = fft->getMaximumMagnitudeAt(sx); 2497 float max = fft->getMaximumMagnitudeAt(sx);
2526 if (max > 0.f) { 2498 if (max > 0.f) {
2527 for (int i = minbin; i <= maxbin; ++i) { 2499 for (int i = minbin; i <= maxbin; ++i) {
2528 values[i - minbin] *= log10(max); 2500 values[i - minbin] *= log10(max);
2544 if (bin > maxbin) break; 2516 if (bin > maxbin) break;
2545 2517
2546 float value = values[bin - minbin]; 2518 float value = values[bin - minbin];
2547 2519
2548 if (m_colourScale != PhaseColourScale) { 2520 if (m_colourScale != PhaseColourScale) {
2549 if (!m_normalizeColumns && !m_normalizeHybrid) { 2521 if (m_normalization != NormalizeColumns) {
2550 value /= (m_fftSize/2.f); 2522 value /= (m_fftSize/2.f);
2551 } 2523 }
2552 mag.sample(value); 2524 mag.sample(value);
2553 value *= m_gain; 2525 value *= m_gain;
2554 } 2526 }
2683 #ifdef DEBUG_SPECTROGRAM_REPAINT 2655 #ifdef DEBUG_SPECTROGRAM_REPAINT
2684 SVDEBUG << "Retrieving column " << sx << " from fft directly" << endl; 2656 SVDEBUG << "Retrieving column " << sx << " from fft directly" << endl;
2685 #endif 2657 #endif
2686 if (m_colourScale == PhaseColourScale) { 2658 if (m_colourScale == PhaseColourScale) {
2687 fft->getPhasesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2659 fft->getPhasesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2688 } else if (m_normalizeColumns) { 2660 } else if (m_normalization == NormalizeColumns) {
2689 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2661 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2690 } else if (m_normalizeHybrid) { 2662 } else if (m_normalization == NormalizeHybrid) {
2691 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2663 fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2692 float max = fft->getMaximumMagnitudeAt(sx); 2664 float max = fft->getMaximumMagnitudeAt(sx);
2665 float scale = log10(max + 1.f);
2666 cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl;
2693 for (int i = minbin; i <= maxbin; ++i) { 2667 for (int i = minbin; i <= maxbin; ++i) {
2694 if (max > 0.f) { 2668 autoarray[i - minbin] *= scale;
2695 autoarray[i - minbin] *= log10(max);
2696 }
2697 } 2669 }
2698 } else { 2670 } else {
2699 fft->getMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1); 2671 fft->getMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
2700 } 2672 }
2701 } else { 2673 } else {
2702 #ifdef DEBUG_SPECTROGRAM_REPAINT 2674 #ifdef DEBUG_SPECTROGRAM_REPAINT
2703 SVDEBUG << "Retrieving column " << sx << " from peaks cache" << endl; 2675 SVDEBUG << "Retrieving column " << sx << " from peaks cache" << endl;
2704 #endif 2676 #endif
2705 c = sourceModel->getColumn(sx); 2677 c = sourceModel->getColumn(sx);
2706 if (m_normalizeColumns || m_normalizeHybrid) { 2678 if (m_normalization == NormalizeColumns ||
2679 m_normalization == NormalizeHybrid) {
2707 for (int y = 0; y < h; ++y) { 2680 for (int y = 0; y < h; ++y) {
2708 if (c[y] > columnMax) columnMax = c[y]; 2681 if (c[y] > columnMax) columnMax = c[y];
2709 } 2682 }
2710 } 2683 }
2711 values = c.constData() + minbin; 2684 values = c.constData() + minbin;
2744 } 2717 }
2745 if (v0 == 0.f && v1 == 0.f) continue; 2718 if (v0 == 0.f && v1 == 0.f) continue;
2746 value = prop * v0 + (1.f - prop) * v1; 2719 value = prop * v0 + (1.f - prop) * v1;
2747 2720
2748 if (m_colourScale != PhaseColourScale) { 2721 if (m_colourScale != PhaseColourScale) {
2749 if (!m_normalizeColumns) { 2722 if (m_normalization != NormalizeColumns &&
2723 m_normalization != NormalizeHybrid) {
2750 value /= (m_fftSize/2.f); 2724 value /= (m_fftSize/2.f);
2751 } 2725 }
2752 mag.sample(value); 2726 mag.sample(value);
2753 value *= m_gain; 2727 value *= m_gain;
2754 } 2728 }
2769 value < values[bin-minbin-1] || 2743 value < values[bin-minbin-1] ||
2770 value < values[bin-minbin+1]) continue; 2744 value < values[bin-minbin+1]) continue;
2771 } 2745 }
2772 2746
2773 if (m_colourScale != PhaseColourScale) { 2747 if (m_colourScale != PhaseColourScale) {
2774 if (!m_normalizeColumns) { 2748 if (m_normalization != NormalizeColumns &&
2749 m_normalization != NormalizeHybrid) {
2775 value /= (m_fftSize/2.f); 2750 value /= (m_fftSize/2.f);
2776 } 2751 }
2777 mag.sample(value); 2752 mag.sample(value);
2778 value *= m_gain; 2753 value *= m_gain;
2779 } 2754 }
2801 for (int y = 0; y < h; ++y) { 2776 for (int y = 0; y < h; ++y) {
2802 2777
2803 float peak = peaks[y]; 2778 float peak = peaks[y];
2804 2779
2805 if (m_colourScale != PhaseColourScale && 2780 if (m_colourScale != PhaseColourScale &&
2806 (m_normalizeColumns || m_normalizeHybrid) && 2781 (m_normalization == NormalizeColumns ||
2782 m_normalization == NormalizeHybrid) &&
2807 columnMax > 0.f) { 2783 columnMax > 0.f) {
2808 peak /= columnMax; 2784 peak /= columnMax;
2809 if (m_normalizeHybrid) { 2785 if (m_normalization == NormalizeHybrid) {
2810 peak *= log10(columnMax); 2786 peak *= log10(columnMax + 1.f);
2811 } 2787 }
2812 } 2788 }
2813 2789
2814 unsigned char peakpix = getDisplayValue(v, peak); 2790 unsigned char peakpix = getDisplayValue(v, peak);
2815 2791
3656 .arg(m_binDisplay); 3632 .arg(m_binDisplay);
3657 3633
3658 s += QString("normalizeColumns=\"%1\" " 3634 s += QString("normalizeColumns=\"%1\" "
3659 "normalizeVisibleArea=\"%2\" " 3635 "normalizeVisibleArea=\"%2\" "
3660 "normalizeHybrid=\"%3\" ") 3636 "normalizeHybrid=\"%3\" ")
3661 .arg(m_normalizeColumns ? "true" : "false") 3637 .arg(m_normalization == NormalizeColumns ? "true" : "false")
3662 .arg(m_normalizeVisibleArea ? "true" : "false") 3638 .arg(m_normalization == NormalizeVisibleArea ? "true" : "false")
3663 .arg(m_normalizeHybrid ? "true" : "false"); 3639 .arg(m_normalization == NormalizeHybrid ? "true" : "false");
3664 3640
3665 Layer::toXml(stream, indent, extraAttributes + " " + s); 3641 Layer::toXml(stream, indent, extraAttributes + " " + s);
3666 } 3642 }
3667 3643
3668 void 3644 void
3726 attributes.value("binDisplay").toInt(&ok); 3702 attributes.value("binDisplay").toInt(&ok);
3727 if (ok) setBinDisplay(binDisplay); 3703 if (ok) setBinDisplay(binDisplay);
3728 3704
3729 bool normalizeColumns = 3705 bool normalizeColumns =
3730 (attributes.value("normalizeColumns").trimmed() == "true"); 3706 (attributes.value("normalizeColumns").trimmed() == "true");
3731 setNormalizeColumns(normalizeColumns); 3707 if (normalizeColumns) {
3708 setNormalization(NormalizeColumns);
3709 }
3732 3710
3733 bool normalizeVisibleArea = 3711 bool normalizeVisibleArea =
3734 (attributes.value("normalizeVisibleArea").trimmed() == "true"); 3712 (attributes.value("normalizeVisibleArea").trimmed() == "true");
3735 setNormalizeVisibleArea(normalizeVisibleArea); 3713 if (normalizeVisibleArea) {
3714 setNormalization(NormalizeVisibleArea);
3715 }
3736 3716
3737 bool normalizeHybrid = 3717 bool normalizeHybrid =
3738 (attributes.value("normalizeHybrid").trimmed() == "true"); 3718 (attributes.value("normalizeHybrid").trimmed() == "true");
3739 setNormalizeHybrid(normalizeHybrid); 3719 if (normalizeHybrid) {
3740 } 3720 setNormalization(NormalizeHybrid);
3741 3721 }
3722 }
3723