2 // 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)
4 #include "bbcreaVtkGrayLevel.h"
5 #include "bbcreaVtkPackage.h"
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,GrayLevel)
12 BBTK_BLACK_BOX_IMPLEMENTATION(GrayLevel,bbtk::AtomicBlackBox);
14 // 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)
16 void GrayLevel::Process()
18 // THE MAIN PROCESSING METHOD BODY
19 // Here we simply set the input 'In' value to the output 'Out'
20 // And print out the output value
21 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
22 // void bbSet{Input|Output}NAME(const TYPE&)
23 // const TYPE& bbGet{Input|Output}NAME() const
25 // * NAME is the name of the input/output
26 // (the one provided in the attribute 'name' of the tag 'input')
27 // * TYPE is the C++ type of the input/output
28 // (the one provided in the attribute 'type' of the tag 'input')
30 // vtkImageData *m_image = vtkImageData::New();
31 // m_image = bbGetInputImage();
32 double grayLevel = -9999;
33 std::vector<double> coord = bbGetInputCoordinate();
37 if (bbGetInputImage()!=NULL)
40 bbGetInputImage()->GetSpacing(spc);
41 bbGetInputImage()->GetExtent(ext);
42 maxX = ext[1]-ext[0]+1;
43 maxY = ext[3]-ext[2]+1;
44 maxZ = ext[5]-ext[4]+1;
47 if (bbGetInputWithSpacing()==true)
60 if ( (px>=0) && (px<maxX) && (py>=0) && (py<maxY) &&(pz>=0) && (pz<maxZ) )
62 grayLevel = bbGetInputImage()->GetScalarComponentAsDouble( px,py,pz,0);
67 std::vector<double> lstGL;
68 std::vector<double> lstX = bbGetInputLstPointsX();
69 std::vector<double> lstY = bbGetInputLstPointsY();
70 std::vector<double> lstZ = bbGetInputLstPointsZ();
71 if ( (lstX.size()==lstY.size()) && (lstY.size()==lstZ.size()) )
73 long int i,size=lstX.size();
76 if (bbGetInputWithSpacing()==true)
90 if ( (px>=0) && (px<maxX) && (py>=0) && (py<maxY) &&(pz>=0) && (pz<maxZ) )
92 lstGL.push_back( bbGetInputImage()->GetScalarComponentAsDouble( px, py,pz,0) );
94 lstGL.push_back( -9991 );
97 bbSetOutputLstGrayLevel(lstGL);
100 bbSetOutputGrayLevel(grayLevel);
104 // 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)
106 void GrayLevel::bbUserSetDefaultValues()
108 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
109 // Here we initialize the input 'In' to 0
110 bbSetInputImage(NULL);
111 bbSetInputWithSpacing(false);
114 // 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)
116 void GrayLevel::bbUserInitializeProcessing()
119 // THE INITIALIZATION METHOD BODY :
121 // but this is where you should allocate the internal/output pointers
127 // 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)
129 void GrayLevel::bbUserFinalizeProcessing()
132 // THE FINALIZATION METHOD BODY :
134 // but this is where you should desallocate the internal/output pointers
139 // EO namespace bbcreaVtk