]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx
Color Layer update
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / ThresholdImageView.cxx
index f20eefcf92e9d57318477c5711e7cd62ecd63d35..0ab4c87e8ac3ac985eb3566b10f14905967a4724 100644 (file)
@@ -81,9 +81,8 @@ void ThresholdImageView::ConfigLookupTable()  // virtual
        int minVal = floor (_minValue);
        int maxVal = floor (_maxValue);
 
-       vtkLookupTable* thresholdTable = GetThresholdTable();
-       thresholdTable->SetNumberOfTableValues(maxTot+1);
-       thresholdTable->SetTableRange(range); 
+       vtkLookupTable *thresholdTable = GetThresholdTable();
+       thresholdTable->SetNumberOfTableValues( (maxTot-minTot) );
        thresholdTable->SetAlphaRange(0, 1);
        thresholdTable->SetValueRange(0, 1);
        thresholdTable->SetSaturationRange(0, 0); 
@@ -91,27 +90,40 @@ void ThresholdImageView::ConfigLookupTable()  // virtual
 
        //Assign a fake color for the upper image, and set the white as transparent
        int i;
-       for(i = minTot; i <= maxTot; i++)
+       int minVal2;
+       int maxVal2;
+       int minTot2;
+       int maxTot2;
+
+       minVal2=minVal-minTot;
+       maxVal2=maxVal-minTot;
+       minTot2=minTot-minTot;
+       maxTot2=maxTot-minTot;
+
+//     thresholdTable->SetTableRange(minVal,maxVal); 
+//EED  You need to do this loop just the first time
+//     for(i = minTot2; i <= maxTot2; i++)
+//     {
+//             thresholdTable->SetTableValue(i,_baseColorR,_baseColorG,_baseColorB, 1);
+//     } // for
+       
+       thresholdTable->SetTableRange(range); 
+       for(i = minTot2; i <= maxTot2; i++)
        {
-               if( i >= minVal && i <= maxVal )
+               if( i >= minVal2 && i <= maxVal2 )
                {
                        thresholdTable->SetTableValue(i,_baseColorR,_baseColorG,_baseColorB, 1);
-               }
-               else if( i >= minTot && i < minVal )
+               } else if( i >= minTot2 && i < minVal2 )
                {
                        thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
-               }
-               else if( i > maxVal && i < maxTot )
+               } else if( i > maxVal2 && i < maxTot2 )
                {
                        thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
-               }
-               else
-               {
+               } else {
                        thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
                }
        } // for
        thresholdTable->Build( );
-
 }