]> Creatis software - creaVtk.git/commitdiff
#3464 Above Below Range color in ScalarsToColors box
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 28 Jun 2021 08:24:58 +0000 (10:24 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 28 Jun 2021 08:24:58 +0000 (10:24 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h

index 50c2cbc2e8532df3618d09af7bf6955a5390e5ec..17780e12aba3d08fa9263c52e0a951141be5a448 100644 (file)
@@ -238,8 +238,6 @@ void ScalarsToColors::Process()
                        {
                                colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]);
 //                             colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
-                               colorLookupTable->SetBelowRangeColor(1,1,1,0);  // White transparent 
-                               colorLookupTable->SetAboveRangeColor(1,1,1,0);  // White transparent 
                                colorLookupTable->UseBelowRangeColorOn();
                                colorLookupTable->UseAboveRangeColorOn();
                        } else {
@@ -268,6 +266,17 @@ void ScalarsToColors::Process()
                                colorLookupTable->GetTableValue(0,rgba);
                                rgba[3]=0;
                                colorLookupTable->SetTableValue(0,rgba);
+
+                               colorLookupTable->UseBelowRangeColorOn();
+                               colorLookupTable->UseAboveRangeColorOn();
+                               if (bbGetInputBelowAboveRangeTransparence()==true)
+                               {
+                                       colorLookupTable->SetBelowRangeColor(1,1,1,0);  // White transparent 
+                                       colorLookupTable->SetAboveRangeColor(1,1,1,0);  // White transparent 
+                               } else {
+                                       colorLookupTable->SetBelowRangeColor(1,1,1,1);  // White transparent 
+                                       colorLookupTable->SetAboveRangeColor(1,1,1,1);  // White transparent 
+                               }
                                
                                // Middle  range
                                int i,iMax=(NumberOfColors/16)*4;
@@ -293,12 +302,19 @@ void ScalarsToColors::Process()
                        if (bbGetInputRange().size()==2)
                        {
                                colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]);
-//                             colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
-                               colorLookupTable->SetBelowRangeColor(1,1,1,0);  // White transparent 
-                               colorLookupTable->SetAboveRangeColor(1,1,1,0);  // White transparent 
+//                             colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);   ????????
+//                             colorLookupTable->SetBelowRangeColor(1,1,1,1);  // White transparent 
+//                             colorLookupTable->SetAboveRangeColor(1,1,1,1);  // White transparent 
                                colorLookupTable->UseBelowRangeColorOn();
                                colorLookupTable->UseAboveRangeColorOn();
-
+                               if (bbGetInputBelowAboveRangeTransparence()==true)
+                               {
+                                       colorLookupTable->SetBelowRangeColor(1,1,1,0);  // White transparent 
+                                       colorLookupTable->SetAboveRangeColor(1,1,1,0);  // White transparent 
+                               } else {
+                                       colorLookupTable->SetBelowRangeColor(1,1,1,1);  // White transparent 
+                                       colorLookupTable->SetAboveRangeColor(1,1,1,1);  // White transparent 
+                               }
                        } else {
                                colorLookupTable->SetRange(0,255);
                        }
@@ -362,6 +378,7 @@ void ScalarsToColors::bbUserSetDefaultValues()
    range.push_back( 1 );
        bbSetInputRange(range);
    bbSetInputScalarValue(0);
+   bbSetInputBelowAboveRangeTransparence(true);
 //   firsttime         = true;
    _scalarstocolors    = NULL;
 }
index 15748a77b9b0f76c5276f8b8b567640d21103204..fc7945d81e13f629f347ea768eda21056a9f20ae 100644 (file)
@@ -25,6 +25,7 @@ class bbcreaVtk_EXPORT ScalarsToColors
 //===== 
   BBTK_DECLARE_INPUT(Type,int);
   BBTK_DECLARE_INPUT(ScalarValue,double);
+  BBTK_DECLARE_INPUT(BelowAboveRangeTransparence,bool);
   BBTK_DECLARE_INPUT(Range,std::vector<double> );
   BBTK_DECLARE_OUTPUT(Color, std::vector<double> );
   BBTK_DECLARE_OUTPUT(LookupTable,vtkScalarsToColors*);
@@ -48,6 +49,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ScalarsToColors,bbtk::AtomicBlackBox);
   BBTK_CATEGORY("empty");
   BBTK_INPUT(ScalarsToColors,Type,"(0 default)  0=JET(transparent for first element and middle range);  100=As 0 without transparace; 1=RangeTable (transparent for first element); 101=As 1 without transparace;  2=DirectionColorRGB;   3=ComponentColorRGB[0-255]",int,"");
   BBTK_INPUT(ScalarsToColors,ScalarValue,"Scalar value -> Color OUT",double,"");
+  BBTK_INPUT(ScalarsToColors,BelowAboveRangeTransparence,"(default true) Transparence for Before and After range true/false",bool,"");
   BBTK_INPUT(ScalarsToColors,Range,"Min Max range",std::vector<double>,"");
   BBTK_OUTPUT(ScalarsToColors,Color,"Color",std::vector<double>,"");
   BBTK_OUTPUT(ScalarsToColors,LookupTable,"LookupTable",vtkScalarsToColors*,"");