--- /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 "bbvtkCreateImage.h"
+#include "bbvtkPackage.h"
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,CreateImage)
+BBTK_BLACK_BOX_IMPLEMENTATION(CreateImage,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 CreateImage::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')
+
+
+ double spc[6];
+ int dim[3];
+ int outputformat = VTK_UNSIGNED_SHORT;
+
+ 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;
+
+ spc[0] = bbGetInputSpacing()[0];
+ spc[1] = bbGetInputSpacing()[1];
+ spc[2] = bbGetInputSpacing()[2];
+
+ dim[0] = bbGetInputDimensions()[0];
+ dim[1] = bbGetInputDimensions()[1];
+ dim[2] = bbGetInputDimensions()[2];
+
+ imageoutput->Initialize();
+ imageoutput->SetScalarType( outputformat );
+ imageoutput->SetSpacing( spc );
+ imageoutput->SetDimensions( dim[0], dim[1], dim[2] );
+ imageoutput->AllocateScalars();
+
+
+ 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++)
+ {
+ imageoutput->SetScalarComponentFromDouble(i,j,k, 0, bbGetInputInitialValue() );
+ } // for k
+ } // for j
+ } // for i
+
+ bbSetOutputOut(imageoutput);
+
+}
+
+//=====
+// 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 CreateImage::bbUserSetDefaultValues()
+{
+ imageoutput=NULL;
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+ std::vector<int> dim;
+ dim.push_back(250);
+ dim.push_back(250);
+ dim.push_back(250);
+ std::vector<double> spc;
+ dim.push_back(1.0);
+ dim.push_back(1.0);
+ dim.push_back(1.0);
+
+ bbSetInputDimensions(dim);
+ bbSetInputSpacing(spc);
+ bbSetInputOutputFormat("VTK_UNSIGNED_SHORT");
+ bbSetInputInitialValue(0);
+}
+
+//=====
+// 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 CreateImage::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+ imageoutput = vtkImageData::New();
+
+}
+
+//=====
+// 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 CreateImage::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+ imageoutput->Delete();
+
+}
+}
+// EO namespace bbvtk
+
+
--- /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 __bbvtkCreateImage_h_INCLUDED__
+#define __bbvtkCreateImage_h_INCLUDED__
+#include "bbvtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+#include <vector>
+#include <string>
+
+
+#include "vtkImageData.h"
+
+namespace bbvtk
+{
+
+class bbvtk_EXPORT CreateImage
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(CreateImage,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(Dimensions,std::vector<int>);
+ BBTK_DECLARE_INPUT(Spacing,std::vector<double>);
+ BBTK_DECLARE_INPUT(OutputFormat,std::string);
+ BBTK_DECLARE_INPUT(InitialValue,double);
+ BBTK_DECLARE_OUTPUT(Out,vtkImageData *);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ vtkImageData* imageoutput;
+
+
+//=====
+// 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(CreateImage,bbtk::AtomicBlackBox);
+
+ BBTK_NAME("CreateImage");
+ BBTK_AUTHOR("Info-Dev");
+ BBTK_DESCRIPTION("Create a new vtkImageData");
+ BBTK_CATEGORY("Filter");
+
+ BBTK_INPUT(CreateImage,Dimensions,"[SizeX SizeY SizeZ] of the image ([250 250 250] default)",std::vector<int>,"");
+ BBTK_INPUT(CreateImage,Spacing,"[SpcX SpcY SpcZ] of the image ([1 1 1] default)",std::vector<double>,"");
+ BBTK_INPUT(CreateImage,OutputFormat,"Image output format: VTK_BIT, VTK_CHAR, VTK_SIGNED_CHAR, VTK_UNSIGNED_CHAR, VTK_SHORT VTK_UNSIGNED_SHORT (default), VTK_INT, VTK_UNSIGNED_INT, VTK_LONG, VTK_UNSIGNED_LONG, VTK_FLOAT, VTK_DOUBLE",std::string,"");
+ BBTK_INPUT(CreateImage,InitialValue,"Initial value inside the image (0 default)",double,"");
+
+ BBTK_OUTPUT(CreateImage,Out,"Output vtkImageData",vtkImageData*,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(CreateImage);
+//=====
+// 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 bbvtk
+
+#endif // __bbvtkCreateImage_h_INCLUDED__
+
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
+ imageoutput->Delete();
}
}
// EO namespace bbvtk
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_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);
//=====