]> Creatis software - clitk.git/commitdiff
solved bug 519 (Fusion flickering)
authorRomulo Pinho <pinho@lyon.fnclcc.fr>
Tue, 7 Jun 2011 12:46:57 +0000 (14:46 +0200)
committerRomulo Pinho <pinho@lyon.fnclcc.fr>
Tue, 7 Jun 2011 12:46:57 +0000 (14:46 +0200)
vv/qt_ui/vvMainWindow.ui
vv/vvMainWindow.cxx
vv/vvOverlayPanel.cxx
vv/vvOverlayPanel.h
vv/vvSlicerManager.cxx

index 7215e621aaf9d7e83bc6ec336c9a38ae09a4e057..6c7c3f8c1a41d59a97f4af5ca49b551571663c22 100644 (file)
            <string>Cold</string>
           </property>
          </item>
+         <item>
+          <property name="text">
+           <string>Dosimetry</string>
+          </property>
+         </item>
          <item>
           <property name="text">
            <string>Full Color</string>
            <number>2</number>
           </property>
           <item row="0" column="0">
-           <widget class="QVTKWidget" name="NOViewWidget" native="true">
+           <widget class="QVTKWidget" name="NOViewWidget">
             <property name="mouseTracking">
              <bool>true</bool>
             </property>
            <number>2</number>
           </property>
           <item row="0" column="0">
-           <widget class="QVTKWidget" name="SOViewWidget" native="true">
+           <widget class="QVTKWidget" name="SOViewWidget">
             <property name="mouseTracking">
              <bool>true</bool>
             </property>
            <number>2</number>
           </property>
           <item row="0" column="0">
-           <widget class="QVTKWidget" name="NEViewWidget" native="true">
+           <widget class="QVTKWidget" name="NEViewWidget">
             <property name="mouseTracking">
              <bool>true</bool>
             </property>
            <number>2</number>
           </property>
           <item row="0" column="0">
-           <widget class="QVTKWidget" name="SEViewWidget" native="true">
+           <widget class="QVTKWidget" name="SEViewWidget">
             <property name="sizePolicy">
              <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
               <horstretch>0</horstretch>
index c60c04da4771dd2c4ec64c753449161ae410189c..07e027951af623749b2408d3afe56e02139b7006 100644 (file)
@@ -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);
index f19e13b0cc167325b3b9b87826a91ac3a098ead9..bc3a7d0180ffa93dcc024c5e14766fe5f3a7daa2 100644 (file)
@@ -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());
 }
index ef0dcf1f352178b5bf9d16c194a0d0ca359f9d42..5000e6444b83ef3248c33b732a3044475b842022 100644 (file)
@@ -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
 //====================================================================
 
index 871c818a64acf3083e4706a5519ce56ae5d6eb33..5a3b44fbf8b2f8ff70e5570c6a3f3933f1ea5aa0 100644 (file)
@@ -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)