--- /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 "bbcreaVtkImageToLstPoints.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageToLstPoints)
+BBTK_BLACK_BOX_IMPLEMENTATION(ImageToLstPoints,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 ImageToLstPoints::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')
+
+ std::vector<int> lstX;
+ std::vector<int> lstY;
+ std::vector<int> lstZ;
+ std::vector<double> lstValues;
+ vtkImageData *img=bbGetInputIn();
+ if (img!=NULL)
+ {
+ int dim[3];
+ int ext[6];
+ img->GetExtent(ext);
+ dim[0] = ext[1]-ext[0]+1;
+ dim[1] = ext[3]-ext[2]+1;
+ dim[2] = ext[5]-ext[4]+1;
+ std::vector<int> lstExt = bbGetInputExtent();
+ if (lstExt.size()!=6)
+ {
+ lstExt.clear();
+ for (int i=0; i<6; i++) lstExt.push_back( ext[i] );
+ } else {
+
+ if (lstExt[0]<0) lstExt[0] = 0;
+ if (lstExt[1]>=dim[0]) lstExt[1] = dim[0]-1;
+ if (lstExt[2]<0) lstExt[2] = 0;
+ if (lstExt[3]>=dim[1]) lstExt[3] = dim[1]-1;
+ if (lstExt[4]<0) lstExt[4] = 0;
+ if (lstExt[5]>=dim[2]) lstExt[5] = dim[2]-1;
+ } // if lstExt size
+ double range[2];
+ img->GetScalarRange(range);
+ std::vector<double> lstRange = bbGetInputRange();
+ if (lstRange.size()!=2)
+ {
+ lstRange.clear();
+ for (int i=0; i<2; i++) lstRange.push_back( range[i] );
+ } // if lstRange size
+
+ double background=bbGetInputBackground();
+ int x,y,z;
+ double value;
+ for (z=lstExt[4] ; z<=lstExt[5] ; z++)
+ {
+ for (y=lstExt[2] ; y<=lstExt[3] ; y++)
+ {
+ for (x=lstExt[0] ; x<=lstExt[1] ; x++)
+ {
+ value = img->GetScalarComponentAsDouble(x,y,z,0);
+ if ((value>=lstRange[0]) && (value<=lstRange[1]))
+ {
+ lstX.push_back(x);
+ lstY.push_back(y);
+ lstZ.push_back(z);
+ lstValues.push_back(value);
+ } else {
+ if ( bbGetInputType() == 1 )
+ {
+ lstX.push_back(x);
+ lstY.push_back(y);
+ lstZ.push_back(z);
+ lstValues.push_back(background);
+ }
+ }// if value
+ }// for x
+ }// for y
+ }// for z
+
+ } // if bbGetInputIn()
+ bbSetOutputLstPointsX( lstX );
+ bbSetOutputLstPointsY( lstY );
+ bbSetOutputLstPointsZ( lstZ );
+ bbSetOutputLstValues( lstValues );
+}
+
+//=====
+// 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 ImageToLstPoints::bbUserSetDefaultValues()
+{
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputIn(NULL);
+ bbSetInputType(0);
+ bbSetInputBackground(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 ImageToLstPoints::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 ImageToLstPoints::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+