--- /dev/null
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+#include "bbvtkRescaleSlopeIntercept.h"
+#include "bbvtkPackage.h"
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,RescaleSlopeIntercept)
+BBTK_BLACK_BOX_IMPLEMENTATION(RescaleSlopeIntercept,bbtk::AtomicBlackBox);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void RescaleSlopeIntercept::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;
+
+
+ double range[2];
+ double spc[6];
+ int dim[3];
+ int ext[6];
+ double value;
+ double newValue;
+ double A=bbGetInputA();
+ double B=bbGetInputB();
+
+ if (bbGetInputIn()!=0)
+ {
+ if (bbGetInputOutputFormat()=="SAME") outputformat = bbGetInputIn()->GetScalarType();
+ else if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT;
+ else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR;
+ else if (bbGetInputOutputFormat()=="VTK_SIGNED_CHAR") outputformat = VTK_SIGNED_CHAR;
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_CHAR") outputformat = VTK_UNSIGNED_CHAR;
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_SHORT") outputformat = VTK_UNSIGNED_SHORT;
+ else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT;
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_INT") outputformat = VTK_UNSIGNED_INT;
+ else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG;
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_LONG") outputformat = VTK_UNSIGNED_LONG;
+ else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT;
+ else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE;
+
+ imageoutput->Initialize();
+ imageoutput->SetScalarType( outputformat );
+ bbGetInputIn()->GetScalarRange(range);
+ bbGetInputIn()->GetSpacing(spc);
+ imageoutput->SetSpacing( spc );
+ bbGetInputIn()->GetWholeExtent(ext);
+ dim[0]=ext[1]-ext[0]+1;
+ dim[1]=ext[3]-ext[2]+1;
+ dim[2]=ext[5]-ext[4]+1;
+ imageoutput->SetDimensions( dim[0] , dim[1], dim[2] );
+ imageoutput->AllocateScalars();
+
+ double range0plusrange1 = range[0]+range[1];
+ double difrange = range[1]-range[0];
+ double newdifrange = B-A;
+
+ int i,j,k;
+ for (i=0; i<dim[0]; i++)
+ {
+ for (j=0; j<dim[1]; j++)
+ {
+ for (k=0; k<dim[2]; k++)
+ {
+ value = bbGetInputIn()->GetScalarComponentAsDouble(i,j,k,0);
+
+ if (bbGetInputType()==0) // Rescale Slope/Intercept
+ {
+ newValue = value*A+B;
+ } // if type 0
+
+ if (bbGetInputType()==1) // Invert
+ {
+ newValue = value*(-1) + (range0plusrange1);
+ } // if type 1
+
+ if (bbGetInputType()==2) // Redimension
+ {
+ newValue = ((value-range[0])/difrange)*newdifrange + A;
+ } // if type 2
+
+ if (bbGetInputType()==3) // Invert redimension
+ {
+ newValue = ((value*(-1)+range[1])/difrange)*newdifrange + A;
+ } // if type 3
+
+ imageoutput->SetScalarComponentFromDouble (i,j,k, 0, newValue);
+ } // for k
+ } // for j
+ } // for i
+
+ bbSetOutputOut(imageoutput);
+ } // if
+}
+
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void RescaleSlopeIntercept::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputIn(NULL);
+ bbSetInputType(0);
+ bbSetInputA(1);
+ bbSetInputB(0);
+ bbSetInputOutputFormat("SAME");
+ imageoutput=NULL;
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void RescaleSlopeIntercept::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+ imageoutput = vtkImageData::New();
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void RescaleSlopeIntercept::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbvtk
+
+
--- /dev/null
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+#ifndef __bbvtkRescaleSlopeIntercept_h_INCLUDED__
+#define __bbvtkRescaleSlopeIntercept_h_INCLUDED__
+#include "bbvtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+
+
+namespace bbvtk
+{
+
+class bbvtk_EXPORT RescaleSlopeIntercept
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(RescaleSlopeIntercept,bbtk::AtomicBlackBox);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+ BBTK_DECLARE_INPUT(In,vtkImageData*);
+ BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_INPUT(A,double);
+ BBTK_DECLARE_INPUT(B,double);
+ BBTK_DECLARE_INPUT(OutputFormat,std::string);
+ BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ int outputformat;
+ vtkImageData* imageoutput;
+
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(RescaleSlopeIntercept,bbtk::AtomicBlackBox);
+BBTK_NAME("RescaleSlopeIntercept");
+BBTK_AUTHOR("eduardo.davila at creatis.insa-lyon.fr");
+BBTK_DESCRIPTION("Rescale Slope Intercept (see Type input descriptio)");
+BBTK_CATEGORY("filter");
+BBTK_INPUT(RescaleSlopeIntercept,In,"Image input",vtkImageData*,"");
+BBTK_INPUT(RescaleSlopeIntercept,Type,"type of operation: 0 (default) SlopeIntercept np=p*A+B, 1 Invert, 2 Redimension A=newMin B=newMax, 3 InvertRedimension A=newMin B=newMax",int,"");
+BBTK_INPUT(RescaleSlopeIntercept,A,"(1 default) see Type description",double,"");
+BBTK_INPUT(RescaleSlopeIntercept,B,"(0 default) see Type description",double,"");
+BBTK_INPUT(RescaleSlopeIntercept,OutputFormat,"Image output format: SAME (default), VTK_BIT, VTK_CHAR, VTK_SIGNED_CHAR, VTK_UNSIGNED_CHAR VTK_SHORT VTK_UNSIGNED_SHORT, VTK_INT, VTK_UNSIGNED_INT, VTK_LONG, VTK_UNSIGNED_LONG, VTK_FLOAT VTK_DOUBLE",std::string,"");
+BBTK_OUTPUT(RescaleSlopeIntercept,Out,"Image output",vtkImageData*,"");
+BBTK_END_DESCRIBE_BLACK_BOX(RescaleSlopeIntercept);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+}
+// EO namespace bbvtk
+
+#endif // __bbvtkRescaleSlopeIntercept_h_INCLUDED__
+