From: Eduardo DAVILA Date: Thu, 15 Jun 2023 09:31:57 +0000 (+0200) Subject: 3511 bbcreaVtkPointPicker bug init point X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8a66dfc699643bfed05605c3683e7c36c02d8bc2;p=creaVtk.git 3511 bbcreaVtkPointPicker bug init point --- diff --git a/bbtk_creaVtk_PKG/.DS_Store b/bbtk_creaVtk_PKG/.DS_Store index 041e49f..16c062d 100644 Binary files a/bbtk_creaVtk_PKG/.DS_Store and b/bbtk_creaVtk_PKG/.DS_Store differ diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx index ba3b39c..9ff9359 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx @@ -225,6 +225,9 @@ void PointPicker::Process() // ....See vtkCommand EventIds } // if bbGetInputRenderer() + std::vector point; + bbSetOutputPoint( point ); + // std::vector lstPoint; // lstPoint.push_back(0); @@ -264,11 +267,11 @@ void PointPicker::bbUserSetDefaultValues() lstNormal.push_back(1); bbSetOutputNormal( lstNormal ); - std::vector point; - point.push_back(20); - point.push_back(20); - point.push_back(20); - bbSetOutputPoint( point ); +// std::vector point; +// point.push_back(-1); +// point.push_back(-1); +// point.push_back(-1); +// bbSetOutputPoint( point ); } //===== diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx index 17780e1..4aceca3 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.cxx @@ -238,11 +238,17 @@ void ScalarsToColors::Process() { colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]); // colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]); - colorLookupTable->UseBelowRangeColorOn(); - colorLookupTable->UseAboveRangeColorOn(); - } else { + } else if (bbGetInputWindowColorLevel().size()==2) { + double w = bbGetInputWindowColorLevel()[0] / 2; + double c = bbGetInputWindowColorLevel()[1]; + colorLookupTable->SetRange( c-w , c+w ); + }else { colorLookupTable->SetRange(0,255); } + + colorLookupTable->UseBelowRangeColorOn(); + colorLookupTable->UseAboveRangeColorOn(); + int NumberOfColors=1000; int NumberOfColorsHalf=NumberOfColors/2; colorLookupTable->SetNumberOfTableValues( NumberOfColors ); @@ -274,7 +280,7 @@ void ScalarsToColors::Process() 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->SetBelowRangeColor(0,0,0,1); // White transparent colorLookupTable->SetAboveRangeColor(1,1,1,1); // White transparent } @@ -299,25 +305,29 @@ void ScalarsToColors::Process() if ((bbGetInputType()==1) || (bbGetInputType()==101) ) { vtkLookupTable *colorLookupTable = vtkLookupTable::New(); - if (bbGetInputRange().size()==2) - { - colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]); -// 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); - } + if (bbGetInputRange().size()==2) + { + colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]); +// colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]); + } else if (bbGetInputWindowColorLevel().size()==2) { + double w = bbGetInputWindowColorLevel()[0] / 2; + double c = bbGetInputWindowColorLevel()[1]; + colorLookupTable->SetRange( c-w , c+w ); + }else { + colorLookupTable->SetRange(0,255); + } + + 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(0,0,0,1); // White transparent + colorLookupTable->SetAboveRangeColor(1,1,1,1); // White transparent + } + colorLookupTable->SetValueRange(0.0, 1.0); // from black to white colorLookupTable->SetSaturationRange(0.0, 0.0); // no color saturation colorLookupTable->SetRampToLinear(); @@ -351,7 +361,6 @@ void ScalarsToColors::Process() _scalarstocolors = _LutEED; } // If Type 3 - // } // firsttime double rgb[3]; std::vectorcolorRGB; @@ -361,53 +370,48 @@ void ScalarsToColors::Process() colorRGB.push_back( rgb[2] ); bbSetOutputColor( colorRGB ); bbSetOutputLookupTable( _scalarstocolors ); - - } + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ScalarsToColors::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputType(0); - std::vectorrange; - range.push_back( 0 ); - range.push_back( 1 ); - bbSetInputRange(range); +// std::vectorrange; +// range.push_back( 0 ); +// range.push_back( 1 ); +// bbSetInputRange(range); bbSetInputScalarValue(0); bbSetInputBelowAboveRangeTransparence(true); // firsttime = true; _scalarstocolors = NULL; } + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ScalarsToColors::bbUserInitializeProcessing() { - // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers -// if any - - +// if any } + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ScalarsToColors::bbUserFinalizeProcessing() { - // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any - } -} -// EO namespace bbcreaVtk + +}// EO namespace bbcreaVtk diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h index fc7945d..1262a48 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScalarsToColors.h @@ -27,6 +27,7 @@ class bbcreaVtk_EXPORT ScalarsToColors BBTK_DECLARE_INPUT(ScalarValue,double); BBTK_DECLARE_INPUT(BelowAboveRangeTransparence,bool); BBTK_DECLARE_INPUT(Range,std::vector ); + BBTK_DECLARE_INPUT(WindowColorLevel,std::vector ); BBTK_DECLARE_OUTPUT(Color, std::vector ); BBTK_DECLARE_OUTPUT(LookupTable,vtkScalarsToColors*); BBTK_PROCESS(Process); @@ -50,7 +51,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ScalarsToColors,bbtk::AtomicBlackBox); 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_INPUT(ScalarsToColors,Range,"(default empty) [min,max] use Range or WindowColorLevel",std::vector,""); + BBTK_INPUT(ScalarsToColors,WindowColorLevel,"default empty [window, color] use Range or WindowColorLevel",std::vector,""); BBTK_OUTPUT(ScalarsToColors,Color,"Color",std::vector,""); BBTK_OUTPUT(ScalarsToColors,LookupTable,"LookupTable",vtkScalarsToColors*,""); BBTK_END_DESCRIBE_BLACK_BOX(ScalarsToColors);