From: Eduardo DAVILA Date: Mon, 28 Jun 2021 08:24:58 +0000 (+0200) Subject: #3464 Above Below Range color in ScalarsToColors box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=6160eaf805347c71784a11c6e2836730bdbc1f0a;p=creaVtk.git #3464 Above Below Range color in ScalarsToColors box --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx index 50c2cbc..17780e1 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx @@ -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; } diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h index 15748a7..fc7945d 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h @@ -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 ); BBTK_DECLARE_OUTPUT(Color, std::vector ); 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,""); BBTK_OUTPUT(ScalarsToColors,Color,"Color",std::vector,""); BBTK_OUTPUT(ScalarsToColors,LookupTable,"LookupTable",vtkScalarsToColors*,"");