]> Creatis software - clitk.git/blobdiff - vv/vvSlicerManager.cxx
Attempt to fix the blend image actor for the new vtk release (5.10)
[clitk.git] / vv / vvSlicerManager.cxx
index 813ba2258bc1f2b247b342f9176e5b2be8f91a4b..3f6f9139fc2e1bec9540eb3480dc49c52b2fdc34 100644 (file)
@@ -62,7 +62,8 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers)
   mFusionColorMap = 3;
   mFusionWindow = 1000;
   mFusionLevel = 1000;
-
+  mFusionShowLegend = true;
+  
   mLandmarks = NULL;
   mLinkedId.resize(0);
 
@@ -1116,13 +1117,17 @@ void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlK
   double min, max;
   int t = this->mSlicers[slicer]->GetTSlice();
   if(bCtrlKey && this->mSlicers[slicer]->GetFusion()) {
-    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetFusion()->GetVTKImages()[t]);
+    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
+                                                          this->mSlicers[slicer]->GetFusion()->GetVTKImages()[t],
+                                                          this->mSlicers[slicer]->GetFusion()->GetTransform());
     this->SetFusionWindow(max-min);
     this->SetFusionLevel(0.5*(min+max));
     this->SetColorMap(mColorMap);
   }
   else if(bCtrlKey && this->mSlicers[slicer]->GetOverlay()) {
-    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetOverlay()->GetVTKImages()[t]);
+    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
+                                                          this->mSlicers[slicer]->GetOverlay()->GetVTKImages()[t],
+                                                          this->mSlicers[slicer]->GetOverlay()->GetTransform());
     if(this->mSlicers[slicer]->GetLinkOverlayWindowLevel()){
       this->SetColorWindow(max-min);
       this->SetColorLevel(0.5*(min+max));
@@ -1132,7 +1137,9 @@ void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlK
     }
   }
   else {
-    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetInput());
+    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
+                                                          this->mSlicers[slicer]->GetImage()->GetVTKImages()[t],
+                                                          this->mSlicers[slicer]->GetImage()->GetTransform());
     this->SetColorWindow(max-min);
     this->SetColorLevel(0.5*(min+max));
     this->SetPreset(6);
@@ -1184,14 +1191,15 @@ void vvSlicerManager::SetColorMap(int colormap)
   case 4:
     if (LUT == NULL)
       LUT = vtkLookupTable::New();
-    LUT->SetValueRange(0,1);
+    LUT->SetValueRange(1,1);
     LUT->SetSaturationRange(1,1);
     LUT->SetHueRange(0,1);
+    LUT->SetAlphaRange(1, 1);
     break;
   case 5:
     if (LUT == NULL)
       LUT = vtkLookupTable::New();
-    LUT->SetValueRange(0.,1);
+    LUT->SetValueRange(1,1);
     LUT->SetSaturationRange(1,1);
     LUT->SetHueRange(1,0.1);
     //LUT->SetRampToLinear();
@@ -1235,15 +1243,17 @@ void vvSlicerManager::SetColorMap(int colormap)
     double v[4];
     
     // set color table transparency
-    double range_end = frange[0] + (double)mFusionThresOpacity*(frange[1] - frange[0])/100;
-    double curr_value = frange[0];
+    //double alpha_range=(double)mFusionThresOpacity/10;
+    double range_end = fusRange[0] + (double)mFusionThresOpacity*(fusRange[1] - fusRange[0])/100;
+    double curr_value = fusRange[0];
     int nvalues = fusLUT->GetNumberOfTableValues();
-    //for (double i = frange[0]; i <= alpha_range_end; i++) {
     for (double i = 0; curr_value < range_end; i++) {  
       fusLUT->GetTableValue(i, v);
       v[3] = 0;
+      //if (curr_value >= -alpha_range && curr_value <= alpha_range) v[3] = pow(fabs(curr_value/alpha_range),2);
+      //else v[3] = 1;
       fusLUT->SetTableValue(i, v);
-      curr_value += (frange[1] - frange[0])/nvalues;
+      curr_value += (fusRange[1] - fusRange[0])/nvalues;
     }
   }
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {
@@ -1276,6 +1286,7 @@ void vvSlicerManager::SetColorMap(int colormap)
     }
     
     if (mSlicers[i]->GetFusion()) {
+      mSlicers[i]->ShowFusionLegend(mFusionShowLegend);
       mSlicers[i]->GetFusionMapper()->SetLookupTable(fusLUT);
       mSlicers[i]->GetFusionActor()->SetOpacity(double(mFusionOpacity)/100);
     }