From: Romulo Pinho Date: Tue, 7 Jun 2011 12:46:57 +0000 (+0200) Subject: solved bug 519 (Fusion flickering) X-Git-Tag: v1.3.0~327 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=7cd2a2b6db7aeb5f9bb4a733ea8b936426d14d3b;p=clitk.git solved bug 519 (Fusion flickering) --- diff --git a/vv/qt_ui/vvMainWindow.ui b/vv/qt_ui/vvMainWindow.ui index 7215e62..6c7c3f8 100644 --- a/vv/qt_ui/vvMainWindow.ui +++ b/vv/qt_ui/vvMainWindow.ui @@ -308,6 +308,11 @@ Cold + + + Dosimetry + + Full Color @@ -621,7 +626,7 @@ 2 - + true @@ -661,7 +666,7 @@ 2 - + true @@ -703,7 +708,7 @@ 2 - + true @@ -740,7 +745,7 @@ 2 - + 0 diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index c60c04d..07e0279 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -1165,6 +1165,7 @@ void vvMainWindow::ImageInfoChanged() overlayPanel->getOverlayName(mSlicerManagers[index]->GetOverlayName().c_str()); overlayPanel->getOverlayProperty(-1); } + if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) { overlayPanel->getFusionName(mSlicerManagers[index]->GetFusionName().c_str()); overlayPanel->getFusionProperty(mSlicerManagers[index]->GetFusionOpacity(), @@ -2145,9 +2146,9 @@ void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) { + mSlicerManagers[index]->SetFusionColorMap(colormap); mSlicerManagers[index]->SetFusionOpacity(opacity); mSlicerManagers[index]->SetFusionThresholdOpacity(thresOpacity); - mSlicerManagers[index]->SetFusionColorMap(colormap); mSlicerManagers[index]->SetFusionWindow(window); mSlicerManagers[index]->SetFusionLevel(level); mSlicerManagers[index]->SetColorMap(0); diff --git a/vv/vvOverlayPanel.cxx b/vv/vvOverlayPanel.cxx index f19e13b..bc3a7d0 100644 --- a/vv/vvOverlayPanel.cxx +++ b/vv/vvOverlayPanel.cxx @@ -49,6 +49,8 @@ vvOverlayPanel::vvOverlayPanel(QWidget * parent):QWidget(parent) connect(fusionColorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFusionProperty())); connect(windowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty())); connect(levelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty())); + + disableFusionSignals = false; } void vvOverlayPanel::getCurrentImageName(QString name) @@ -167,18 +169,24 @@ void vvOverlayPanel::getFusionName(QString name) void vvOverlayPanel::getFusionProperty(int opacity, int thresOpacity, int colormap, double window, double level) { if (opacity > -1) { + //first disable signals generated by each setValue() call + disableFusionSignals = true; fusionFrame->show(); fusionFrame->setEnabled(1); + fusionColorMapComboBox->setEnabled(1); + fusionColorMapComboBox->setCurrentIndex(colormap); opacityHorizontalSlider->setEnabled(1); opacityHorizontalSlider->setValue(opacity); thresOpacityHorizontalSlider->setEnabled(1); thresOpacityHorizontalSlider->setValue(thresOpacity); - fusionColorMapComboBox->setEnabled(1); - fusionColorMapComboBox->setCurrentIndex(colormap); windowSpinBox->setEnabled(1); levelSpinBox->setEnabled(1); windowSpinBox->setValue(window); levelSpinBox->setValue(level); + + // re-enable signals and trigger slot function + disableFusionSignals = false; + setFusionProperty(); } else { fusionFrame->hide(); fusionFrame->setEnabled(0); @@ -195,6 +203,9 @@ void vvOverlayPanel::getFusionProperty(int opacity, int thresOpacity, int colorm void vvOverlayPanel::setFusionProperty() { + if (disableFusionSignals) + return; + emit FusionPropertyUpdated(opacityHorizontalSlider->value(), thresOpacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(), windowSpinBox->value(), levelSpinBox->value()); } diff --git a/vv/vvOverlayPanel.h b/vv/vvOverlayPanel.h index ef0dcf1..5000e64 100644 --- a/vv/vvOverlayPanel.h +++ b/vv/vvOverlayPanel.h @@ -58,6 +58,11 @@ signals: void VFPropertyUpdated(int subsampling, int scale, int log, int width, double r, double g, double b); void OverlayPropertyUpdated(int color); void FusionPropertyUpdated(int opacity, int thresOpacity, int colormap, double window, double level); + + +private: + bool disableFusionSignals; + }; // end class vvOverlayPanel //==================================================================== diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 871c818..5a3b44f 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -1076,6 +1076,13 @@ void vvSlicerManager::SetColorMap(int colormap) LUT->SetHueRange(0.4,0.80); break; case 3: + if (LUT == NULL) + LUT = vtkLookupTable::New(); + LUT->SetValueRange(0.5,1); + LUT->SetSaturationRange(1,1); + LUT->SetHueRange(0.666,0); + break; + case 4: if (LUT == NULL) LUT = vtkLookupTable::New(); LUT->SetValueRange(0,1); @@ -1096,7 +1103,7 @@ void vvSlicerManager::SetColorMap(int colormap) LUT->Build(); } vtkWindowLevelLookupTable* fusLUT = NULL; - if (mSlicers[0]->GetFusion()) { // && mFusionColorMap != 0) { + if (mSlicers[0]->GetFusion()) { // && mFusionColorMap >= 0) { fusLUT = vtkWindowLevelLookupTable::New(); double fusRange [2]; fusRange[0] = mFusionLevel - mFusionWindow/2; @@ -1119,7 +1126,7 @@ void vvSlicerManager::SetColorMap(int colormap) } else if (mFusionColorMap == 4) fusLUT->SetHueRange(0,1); - else if (mFusionColorMap == 0) + else if (mFusionColorMap <= 0) { fusLUT->SetValueRange(0,1); fusLUT->SetSaturationRange(0,0); @@ -1127,7 +1134,7 @@ void vvSlicerManager::SetColorMap(int colormap) fusLUT->ForceBuild(); - // set color table transparancy + // set color table transparency double alpha_range_end = frange[0] + (double)mFusionThresOpacity*(frange[1] - frange[0])/100; for (double i = frange[0]; i < alpha_range_end; i++) { double v[4]; @@ -1167,8 +1174,8 @@ void vvSlicerManager::SetColorMap(int colormap) } if (mSlicers[i]->GetFusion()) { - mSlicers[i]->GetFusionActor()->SetOpacity(double(mFusionOpacity)/100); mSlicers[i]->GetFusionMapper()->SetLookupTable(fusLUT); + mSlicers[i]->GetFusionActor()->SetOpacity(double(mFusionOpacity)/100); } } if (fusLUT)