--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/CompareImagesByRGB-Widget.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:CompareImagesByRGB-Widget
+PACKAGENAME:creaVtk
+COMPLEXOUTPUTS:1
+COMPLEX_PORT
+OutWidget
+-141.188304:-163.078587:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:2
+COMPLEX_PORT
+Image1
+-40.537616:163.388080:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+Image2
+30.013598:159.944870:-900.000000
+FIN_COMPLEX_PORT
+BOXES:19
+BOX
+creaMaracasVisu:ViewerNV:Box00
+ISEXEC:FALSE
+-40.530599:-56.614429:-900.000000
+23.189401:-66.614429:-900.000000
+PORT
+nTypeView:"1 2 0"
+FIN_BOX
+BOX
+creaVtk:ImageAppendComponents:Box02
+ISEXEC:FALSE
+-203.582916:-29.421199:-900.000000
+-150.532916:-39.421199:-900.000000
+FIN_BOX
+BOX
+vtk:RescaleSlopeIntercept:Box05
+ISEXEC:FALSE
+-43.951428:89.905525:-900.000000
+4.173572:79.905525:-900.000000
+PORT
+A:"0"
+PORT
+B:"255"
+PORT
+OutputFormat:"VTK_UNSIGNED_CHAR"
+PORT
+Type:"2"
+FIN_BOX
+BOX
+creaMaracasVisu:SetwxVtkBaseViewLookupTable:Box06
+ISEXEC:FALSE
+-4.167113:-82.518808:-900.000000
+52.682887:-92.518808:-900.000000
+FIN_BOX
+BOX
+wx:LayoutSplit:Box07
+ISEXEC:FALSE
+-141.202294:-144.516735:-900.000000
+-102.122294:-154.516735:-900.000000
+PORT
+Proportion:"90"
+FIN_BOX
+BOX
+creaVtk:ScalarsToColors:Box10
+ISEXEC:FALSE
+55.522942:-52.647302:-900.000000
+97.047942:-62.647302:-900.000000
+PORT
+Type:"3"
+FIN_BOX
+BOX
+vtk:RescaleSlopeIntercept:Box13
+ISEXEC:FALSE
+23.644953:90.680497:-900.000000
+71.769953:80.680497:-900.000000
+PORT
+A:"0"
+PORT
+B:"255"
+PORT
+OutputFormat:"VTK_UNSIGNED_CHAR"
+PORT
+Type:"2"
+FIN_BOX
+BOX
+std:StringSelect:Box18
+ISEXEC:FALSE
+-202.842874:73.343866:-900.000000
+-160.682874:63.343866:-900.000000
+PORT
+In0:"1 1 1"
+PORT
+In1:"0 0 0"
+PORT
+In2:"1 0 0"
+PORT
+In3:"0 1 0"
+PORT
+In4:"0 0 1"
+PORT
+In5:"1 1 0"
+PORT
+In6:"1 0 1"
+PORT
+In7:"0 1 1"
+FIN_BOX
+BOX
+PackRecalage:AddImageToVector:Box19
+ISEXEC:FALSE
+-13.743788:38.895326:-900.000000
+31.656212:28.895326:-900.000000
+FIN_BOX
+BOX
+std:GetVectorStringElement:Box20
+ISEXEC:FALSE
+-271.077722:53.758698:-900.000000
+-221.677722:43.758698:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:GetVectorStringElement:Box21
+ISEXEC:FALSE
+-205.073499:53.172640:-900.000000
+-155.673499:43.172640:-900.000000
+PORT
+I:"1"
+FIN_BOX
+BOX
+std:GetVectorStringElement:Box22
+ISEXEC:FALSE
+-138.754214:52.260973:-900.000000
+-89.354214:42.260973:-900.000000
+PORT
+I:"2"
+FIN_BOX
+BOX
+vtk:GetVectorVtkImageDataElement:Box23
+ISEXEC:FALSE
+-270.964594:-0.569468:-900.000000
+-212.714594:-10.569468:-900.000000
+FIN_BOX
+BOX
+vtk:GetVectorVtkImageDataElement:Box24
+ISEXEC:FALSE
+-185.710508:-1.005972:-900.000000
+-127.460508:-11.005972:-900.000000
+FIN_BOX
+BOX
+vtk:GetVectorVtkImageDataElement:Box25
+ISEXEC:FALSE
+-98.887475:-1.939186:-900.000000
+-40.637475:-11.939186:-900.000000
+FIN_BOX
+BOX
+wx:Slider:Box26
+ISEXEC:FALSE
+-306.701264:117.651337:-900.000000
+-255.301264:107.651337:-900.000000
+PORT
+Max:"7"
+PORT
+Min:"0"
+FIN_BOX
+BOX
+wx:LayoutCenter:Box28
+ISEXEC:FALSE
+-292.546520:-51.671504:-900.000000
+-253.246520:-61.671504:-900.000000
+FIN_BOX
+BOX
+vtk:vtkImageDataPointerRelay:Box29
+ISEXEC:FALSE
+-48.945155:121.673754:-900.000000
+3.229845:111.673754:-900.000000
+FIN_BOX
+BOX
+vtk:vtkImageDataPointerRelay:Box30
+ISEXEC:FALSE
+24.733746:117.421238:-900.000000
+76.908746:107.421238:-900.000000
+FIN_BOX
+CONNECTIONS:29
+CONNECTION
+Box02:Out:Box00:In
+NumberOfControlPoints:0
+CONNECTION
+Box10:LookupTable:Box06:ScalarToColors
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box19:In0
+NumberOfControlPoints:0
+CONNECTION
+Box13:Out:Box19:In1
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box20:In
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box21:In
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box22:In
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box23:In
+NumberOfControlPoints:0
+CONNECTION
+Box20:Out:Box23:I
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box24:In
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box25:In
+NumberOfControlPoints:0
+CONNECTION
+Box21:Out:Box24:I
+NumberOfControlPoints:0
+CONNECTION
+Box22:Out:Box25:I
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box02:In0
+NumberOfControlPoints:0
+CONNECTION
+Box24:Out:Box02:In1
+NumberOfControlPoints:0
+CONNECTION
+Box25:Out:Box02:In2
+NumberOfControlPoints:0
+CONNECTION
+Box26:Out:Box18:In
+NumberOfControlPoints:0
+CONNECTION
+Box00:Widget:Box07:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box26:Widget:Box28:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box28:Widget:Box07:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box00:wxVtkBaseView1:Box06:BaseView1
+NumberOfControlPoints:0
+CONNECTION
+Box00:wxVtkBaseView2:Box06:BaseView2
+NumberOfControlPoints:0
+CONNECTION
+Box00:wxVtkBaseView3:Box06:BaseView3
+NumberOfControlPoints:0
+CONNECTION
+Box29:Out:Box05:In
+NumberOfControlPoints:0
+CONNECTION
+Box30:Out:Box13:In
+NumberOfControlPoints:0
+CONNECTION
+Image1:Image1:Box29:In
+NumberOfControlPoints:0
+CONNECTION
+Image2:Image2:Box30:In
+NumberOfControlPoints:0
+CONNECTION
+Box07:Widget:OutWidget:OutWidget
+NumberOfControlPoints:0
+CONNECTION
+Box26:BoxChange:Box06:BoxExecute
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/C8/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/boxes/CompareImagesByRGB-Widget.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include creaMaracasVisu
+include creaVtk
+include vtk
+include wx
+include std
+include PackRecalage
+
+define CompareImagesByRGB-Widget creaVtk
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new creaMaracasVisu:ViewerNV Box00
+ set Box00.nTypeView "1 2 0"
+
+new creaVtk:ImageAppendComponents Box02
+
+new vtk:RescaleSlopeIntercept Box05
+ set Box05.A "0"
+ set Box05.B "255"
+ set Box05.OutputFormat "VTK_UNSIGNED_CHAR"
+ set Box05.Type "2"
+
+new creaMaracasVisu:SetwxVtkBaseViewLookupTable Box06
+
+new wx:LayoutSplit Box07
+ set Box07.Proportion "90"
+
+new creaVtk:ScalarsToColors Box10
+ set Box10.Type "3"
+
+new vtk:RescaleSlopeIntercept Box13
+ set Box13.A "0"
+ set Box13.B "255"
+ set Box13.OutputFormat "VTK_UNSIGNED_CHAR"
+ set Box13.Type "2"
+
+new std:StringSelect Box18
+ set Box18.In0 "1 1 1"
+ set Box18.In1 "0 0 0"
+ set Box18.In2 "1 0 0"
+ set Box18.In3 "0 1 0"
+ set Box18.In4 "0 0 1"
+ set Box18.In5 "1 1 0"
+ set Box18.In6 "1 0 1"
+ set Box18.In7 "0 1 1"
+
+new PackRecalage:AddImageToVector Box19
+
+new std:GetVectorStringElement Box20
+ set Box20.I "0"
+
+new std:GetVectorStringElement Box21
+ set Box21.I "1"
+
+new std:GetVectorStringElement Box22
+ set Box22.I "2"
+
+new vtk:GetVectorVtkImageDataElement Box23
+
+new vtk:GetVectorVtkImageDataElement Box24
+
+new vtk:GetVectorVtkImageDataElement Box25
+
+new wx:Slider Box26
+ set Box26.Max "7"
+ set Box26.Min "0"
+
+new wx:LayoutCenter Box28
+
+new vtk:vtkImageDataPointerRelay Box29
+
+new vtk:vtkImageDataPointerRelay Box30
+
+
+connect Box02.Out Box00.In
+connect Box10.LookupTable Box06.ScalarToColors
+connect Box05.Out Box19.In0
+connect Box13.Out Box19.In1
+connect Box18.Out Box20.In
+connect Box18.Out Box21.In
+connect Box18.Out Box22.In
+connect Box19.Out Box23.In
+connect Box20.Out Box23.I
+connect Box19.Out Box24.In
+connect Box19.Out Box25.In
+connect Box21.Out Box24.I
+connect Box22.Out Box25.I
+connect Box23.Out Box02.In0
+connect Box24.Out Box02.In1
+connect Box25.Out Box02.In2
+connect Box26.Out Box18.In
+connect Box00.Widget Box07.Widget1
+connect Box26.Widget Box28.Widget2
+connect Box28.Widget Box07.Widget2
+connect Box00.wxVtkBaseView1 Box06.BaseView1
+connect Box00.wxVtkBaseView2 Box06.BaseView2
+connect Box00.wxVtkBaseView3 Box06.BaseView3
+connect Box29.Out Box05.In
+connect Box30.Out Box13.In
+connect Box26.BoxChange Box06.BoxExecute
+
+# Complex input ports
+input Image1 Box29.In " "
+input Image2 Box30.In " "
+
+# Complex output ports
+output OutWidget Box07.Widget " "
+
+
+endefine
--- /dev/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)
+//=====
+#include "bbcreaVtkImageAppendComponents.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageAppendComponents)
+BBTK_BLACK_BOX_IMPLEMENTATION(ImageAppendComponents,bbtk::AtomicBlackBox);
+//=====
+// 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 ImageAppendComponents::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ if (_appendFilter!=NULL)
+ {
+ _appendFilter->Delete();
+ } //
+ _appendFilter = vtkImageAppendComponents::New();
+ _appendFilter->SetInputData( bbGetInputIn0() );
+ _appendFilter->AddInputData( bbGetInputIn1() );
+ _appendFilter->AddInputData( bbGetInputIn2() );
+ _appendFilter->AddInputData( bbGetInputIn3() );
+ _appendFilter->Update();
+ bbSetOutputOut( _appendFilter->GetOutput() );
+}
+//=====
+// 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 ImageAppendComponents::bbUserSetDefaultValues()
+{
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ _appendFilter=NULL;
+ bbSetInputIn0(NULL);
+ bbSetInputIn1(NULL);
+ bbSetInputIn2(NULL);
+ bbSetInputIn3(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 ImageAppendComponents::bbUserInitializeProcessing()
+{
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// 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 ImageAppendComponents::bbUserFinalizeProcessing()
+{
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+}
+
+}// EO namespace bbcreaVtk
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaVtkImageAppendComponents_h_INCLUDED__
+#define __bbcreaVtkImageAppendComponents_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+#include "vtkImageAppendComponents.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT ImageAppendComponents
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ImageAppendComponents,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(In0,vtkImageData*);
+ BBTK_DECLARE_INPUT(In1,vtkImageData*);
+ BBTK_DECLARE_INPUT(In2,vtkImageData*);
+ BBTK_DECLARE_INPUT(In3,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ vtkImageAppendComponents *_appendFilter;
+
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageAppendComponents,bbtk::AtomicBlackBox);
+ BBTK_NAME("ImageAppendComponents");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(ImageAppendComponents,In0,"Image Component",vtkImageData*,"");
+ BBTK_INPUT(ImageAppendComponents,In1,"Image Component",vtkImageData*,"");
+ BBTK_INPUT(ImageAppendComponents,In2,"Image Component",vtkImageData*,"");
+ BBTK_INPUT(ImageAppendComponents,In3,"Image Component",vtkImageData*,"");
+
+ BBTK_OUTPUT(ImageAppendComponents,Out,"Output image with some components",vtkImageData*,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(ImageAppendComponents);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkImageAppendComponents_h_INCLUDED__
+
#include "bbcreaVtkScalarsToColors.h"
#include "bbcreaVtkPackage.h"
+#include "vtkLookupTable.h"
+#include "vtkObjectFactory.h"
+
namespace bbcreaVtk
{
+class /*VTK_COMMON_EXPORT*/ vtkLookupTableDirectionVector2 : public vtkScalarsToColors
+{
+public:
+ // Description:
+ // Construct with range=[0,1]; and hsv ranges set up for rainbow color table
+ // (from red to blue).
+ static vtkLookupTableDirectionVector2 *New();
+ vtkTypeMacro(vtkLookupTableDirectionVector2,vtkScalarsToColors);
+ void PrintSelf(ostream& os, vtkIndent indent);
+ double *GetRange() { return this->GetTableRange(); };
+ void SetRange(double min, double max) { this->SetTableRange(min, max); };
+ void SetRange(double rng[2]) { this->SetRange(rng[0], rng[1]); };
+ void SetTableRange(double r[2]);
+ virtual void SetTableRange(double min, double max);
+ vtkGetVectorMacro(TableRange,double,2);
+ unsigned char *MapValue(double v);
+ void GetColor(double x, double rgb[3]);
+ void MapScalarsThroughTable2(void *input, unsigned char *output,
+ int inputDataType, int numberOfValues,
+ int inputIncrement, int outputIncrement);
+ void SetTypeTable( int typetable );
+protected:
+ double TableRange[2];
+ vtkLookupTableDirectionVector2(int sze=256, int ext=256);
+ ~vtkLookupTableDirectionVector2();
+private:
+ int TypeTable; //EED
+ vtkLookupTableDirectionVector2(const vtkLookupTableDirectionVector2&); // Not implemented.
+ void operator=(const vtkLookupTableDirectionVector2&); // Not implemented.
+};
+
+
+
+
+vtkStandardNewMacro(vtkLookupTableDirectionVector2);
+
+// Construct with range=(0,1); and hsv ranges set up for rainbow color table
+// (from red to blue).
+vtkLookupTableDirectionVector2::vtkLookupTableDirectionVector2(int sze, int ext)
+{
+ this->TableRange[0] = 0.0;
+ this->TableRange[1] = 1.0;
+ TypeTable=0;
+}
+
+//----------------------------------------------------------------------------
+vtkLookupTableDirectionVector2::~vtkLookupTableDirectionVector2()
+{
+}
+
+unsigned char *vtkLookupTableDirectionVector2::MapValue(double v)
+{
+
+ //int idx = this->GetIndex(v);
+ //return (this->Table->GetPointer(0) + 4*idx);
+ return 0;
+}
+
+void vtkLookupTableDirectionVector2::GetColor(double v, double rgb[3])
+{
+// unsigned char *rgb8 = this->MapValue(v);
+// rgb[0] = rgb8[0]/255.0;
+// rgb[1] = rgb8[1]/255.0;
+// rgb[2] = rgb8[2]/255.0;
+
+ rgb[0] = 1;
+ rgb[1] = 1;
+ rgb[2] = 0;
+}
+
+
+void vtkLookupTableDirectionVector2::SetTableRange(double r[2])
+{
+ this->SetTableRange(r[0],r[1]);
+}
+
+void vtkLookupTableDirectionVector2::SetTypeTable( int typetable )
+{
+ TypeTable=typetable;
+}
+
+//----------------------------------------------------------------------------
+// Set the minimum/maximum scalar values for scalar mapping. Scalar values
+// less than minimum range value are clamped to minimum range value.
+// Scalar values greater than maximum range value are clamped to maximum
+// range value.
+void vtkLookupTableDirectionVector2::SetTableRange(double rmin, double rmax)
+{
+ if (rmax < rmin)
+ {
+ vtkErrorMacro("Bad table range: ["<<rmin<<", "<<rmax<<"]");
+ return;
+ }
+
+ if (this->TableRange[0] == rmin && this->TableRange[1] == rmax)
+ {
+ return;
+ }
+
+ this->TableRange[0] = rmin;
+ this->TableRange[1] = rmax;
+
+ this->Modified();
+}
+
+
+
+//----------------------------------------------------------------------------
+// Although this is a relatively expensive calculation,
+// it is only done on the first render. Colors are cached
+// for subsequent renders.
+template<class T>
+void vtkLookupTableMapDirVectorEED2(vtkLookupTableDirectionVector2 *self, T *input,
+ unsigned char *output, int length,
+ int inIncr, int outFormat,int TypeTable)
+{
+
+ if (TypeTable==0)
+ {
+ double sum;
+ int i;
+ double dirx,diry,dirz;
+ for (i = 0; i < length; ++i)
+ {
+ dirx = static_cast<T>(input[0]);
+ diry = static_cast<T>(input[1]);
+ dirz = static_cast<T>(input[2]);
+ input = input+inIncr;
+ sum = sqrt( dirx*dirx + diry*diry + dirz*dirz );
+ *output++ = (unsigned char) abs( (255*dirx/sum) );
+ *output++ = (unsigned char) abs( (255*diry/sum) );
+ *output++ = (unsigned char) abs( (255*dirz/sum) );
+ *output++ = 255;
+ // printf("%d %d %d ",(int)(255*dirx/sum),(int)(255*diry/sum),(int)(255*dirz/sum));
+ // printf(" C %d %f %f %f \n",inIncr,dirx,diry,dirz);
+
+ } // for
+ } // typeTable == 0
+
+ if (TypeTable==1)
+ {
+ int i;
+ for (i = 0; i < length; ++i)
+ {
+ *output++ = static_cast<T>(input[0]); // red
+ *output++ = static_cast<T>(input[1]); // green
+ *output++ = static_cast<T>(input[2]); // blue
+// *output++ = 255;
+ input = input+inIncr;
+ } // for
+ } // typeTable == 1
+
+
+}
+
+
+//----------------------------------------------------------------------------
+void vtkLookupTableDirectionVector2::MapScalarsThroughTable2(void *input,
+ unsigned char *output,
+ int inputDataType,
+ int numberOfValues,
+ int inputIncrement,
+ int outputFormat)
+{
+// if (this->UseMagnitude && inputIncrement > 1)
+// {
+ switch (inputDataType)
+ {
+ vtkTemplateMacro( vtkLookupTableMapDirVectorEED2(this,static_cast<VTK_TT*>(input),output,
+ numberOfValues,inputIncrement,outputFormat,TypeTable);
+ return
+ );
+ case VTK_BIT:
+ vtkErrorMacro("Cannot comput magnitude of bit array.");
+ break;
+ default:
+ vtkErrorMacro(<< "MapImageThroughTable: Unknown input ScalarType");
+ } /// switch
+// } //if
+}
+
+
+//----------------------------------------------------------------------------
+void vtkLookupTableDirectionVector2::PrintSelf(ostream& os, vtkIndent indent)
+{
+ this->Superclass::PrintSelf(os,indent);
+}
+
+
+
+
+
+
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ScalarsToColors)
BBTK_BLACK_BOX_IMPLEMENTATION(ScalarsToColors,bbtk::AtomicBlackBox);
//=====
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-printf("EED ScalarsToColors::Process Start\n");
+
+printf("EED ScalarsToColors::Process Start\n");
+
if (firsttime==true)
{
firsttime=false;
// Create the color map
if (bbGetInputType()==0)
{
- _colorLookupTable = vtkLookupTable::New();
+ vtkLookupTable *colorLookupTable = vtkLookupTable::New();
if (bbGetInputRange().size()==2)
{
- _colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]);
-// _colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
+ colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]);
+// colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
} else {
- _colorLookupTable->SetRange(0,255);
+ colorLookupTable->SetRange(0,255);
}
- _colorLookupTable->SetNumberOfTableValues(1000);
- _colorLookupTable->Build();
+ colorLookupTable->SetNumberOfTableValues(1000);
+ colorLookupTable->Build();
double rgba1[4];
double rgba2[4];
int iLookTable;
for (iLookTable = 0; iLookTable<500; iLookTable++)
{
- _colorLookupTable->GetTableValue( iLookTable, rgba1);
- _colorLookupTable->GetTableValue(1000-1-iLookTable, rgba2);
- _colorLookupTable->SetTableValue(1000-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
- _colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
+ colorLookupTable->GetTableValue( iLookTable, rgba1);
+ colorLookupTable->GetTableValue(1000-1-iLookTable, rgba2);
+ colorLookupTable->SetTableValue(1000-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
+ colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
} // for iLookTable
double rgba[4];
- _colorLookupTable->GetTableValue(0,rgba);
+ colorLookupTable->GetTableValue(0,rgba);
rgba[3]=0;
- _colorLookupTable->SetTableValue(0,rgba);
-
+ colorLookupTable->SetTableValue(0,rgba);
int i,iMax;
-
iMax=(1000/16)*4;
for (i=0;i<iMax;i++)
{
-
- _colorLookupTable->GetTableValue(500+i, rgba);
+ colorLookupTable->GetTableValue(500+i, rgba);
rgba[3]=(double)i/(double)iMax;
- _colorLookupTable->SetTableValue(500+i,rgba);
- _colorLookupTable->GetTableValue(500-i, rgba);
+ colorLookupTable->SetTableValue(500+i,rgba);
+ colorLookupTable->GetTableValue(500-i, rgba);
rgba[3]=(double)i/(double)iMax;
- _colorLookupTable->SetTableValue(500-i,rgba);
-
+ colorLookupTable->SetTableValue(500-i,rgba);
} // for
-
-
/*
iMax=100;
for (i=0;i<iMax;i++)
_colorLookupTable->SetTableValue(500-i,rgba);
} // for
*/
-
-
-
+ _scalarstocolors = colorLookupTable;
} // if Type 0
//EED 2018-06-8 ***********************ARDS Projet***********************************************
if (bbGetInputType()==1)
{
- _colorLookupTable = vtkLookupTable::New();
+ vtkLookupTable *colorLookupTable = vtkLookupTable::New();
if (bbGetInputRange().size()==2)
{
- _colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]);
-// _colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
+ colorLookupTable->SetRange( bbGetInputRange()[0],bbGetInputRange()[1]);
+// colorLookupTable->SetTableRange( bbGetInputRange()[0],bbGetInputRange()[1]);
} else {
- _colorLookupTable->SetRange(0,255);
+ colorLookupTable->SetRange(0,255);
}
- _colorLookupTable->SetValueRange(0.0, 1.0); // from black to white
- _colorLookupTable->SetSaturationRange(0.0, 0.0); // no color saturation
- _colorLookupTable->SetRampToLinear();
- _colorLookupTable->Build();
+ colorLookupTable->SetValueRange(0.0, 1.0); // from black to white
+ colorLookupTable->SetSaturationRange(0.0, 0.0); // no color saturation
+ colorLookupTable->SetRampToLinear();
+ colorLookupTable->Build();
double rgba[4];
- _colorLookupTable->GetTableValue(0,rgba);
+ colorLookupTable->GetTableValue(0,rgba);
rgba[3]=0;
- _colorLookupTable->SetTableValue(0,rgba);
- } // IF
+ colorLookupTable->SetTableValue(0,rgba);
+ _scalarstocolors = colorLookupTable;
+ } // If Type 1
+ if (bbGetInputType()==2) // Direction Color Vector
+ {
+ vtkLookupTableDirectionVector2 *_LutEED = vtkLookupTableDirectionVector2::New();
+ _LutEED->SetVectorModeToRGBColors();
+ _LutEED->SetTypeTable(0);
+ _scalarstocolors = _LutEED;
+ } // If Type 2
+ if (bbGetInputType()==3) // Componets image rgb [0 255]
+ {
+ vtkLookupTableDirectionVector2 *_LutEED = vtkLookupTableDirectionVector2::New();
+ _LutEED->SetVectorModeToRGBColors();
+ _LutEED->SetTypeTable(1); // for components image
+ _scalarstocolors = _LutEED;
+ } // If Type 3
- } // firsttime
+ } // firsttime
double rgb[3];
std::vector<double>colorRGB;
- _colorLookupTable->GetColor( bbGetInputScalarValue() , rgb );
+ _scalarstocolors->GetColor( bbGetInputScalarValue() , rgb );
colorRGB.push_back( rgb[0] );
colorRGB.push_back( rgb[1] );
colorRGB.push_back( rgb[2] );
bbSetOutputColor( colorRGB );
- bbSetOutputLookupTable(_colorLookupTable);
+ bbSetOutputLookupTable( _scalarstocolors );
+
+printf("EED ScalarsToColors::Process End\n");
-printf("EED ScalarsToColors::Process End\n");
}
//=====
range.push_back( 1 );
bbSetInputRange(range);
bbSetInputScalarValue(0);
- firsttime=true;
-
- _colorLookupTable=NULL;
+ 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 Process();
bool firsttime;
- vtkLookupTable *_colorLookupTable;
+ vtkScalarsToColors *_scalarstocolors;
vtkColorTransferFunction *_volumeColor;
BBTK_AUTHOR("Info-Dev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
- BBTK_INPUT(ScalarsToColors,Type,"0 (default) Type of color table",int,"");
+ BBTK_INPUT(ScalarsToColors,Type,"0 (default) 0=JET 1=RangeTable 2=DirectionColorRGB 3=ComponentColorRGB[0-255]",int,"");
BBTK_INPUT(ScalarsToColors,ScalarValue,"Scalar value -> Color OUT",double,"");
BBTK_INPUT(ScalarsToColors,Range,"Min Max range",std::vector<double>,"");
BBTK_OUTPUT(ScalarsToColors,Color,"Color",std::vector<double>,"");