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"
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,GrayLevel)
10 BBTK_BLACK_BOX_IMPLEMENTATION(GrayLevel,bbtk::AtomicBlackBox);
12 // 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)
14 void GrayLevel::Process()
17 printf ("EED GrayLevel::Process Start\n");
19 // THE MAIN PROCESSING METHOD BODY
20 // Here we simply set the input 'In' value to the output 'Out'
21 // And print out the output value
22 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
23 // void bbSet{Input|Output}NAME(const TYPE&)
24 // const TYPE& bbGet{Input|Output}NAME() const
26 // * NAME is the name of the input/output
27 // (the one provided in the attribute 'name' of the tag 'input')
28 // * TYPE is the C++ type of the input/output
29 // (the one provided in the attribute 'type' of the tag 'input')
31 // vtkImageData *m_image = vtkImageData::New();
32 // m_image = bbGetInputImage();
34 double grayLevel = -9999;
35 std::vector<double> coord = bbGetInputCoordinate();
41 if (bbGetInputImage()!=NULL)
44 bbGetInputImage()->GetSpacing(spc);
45 bbGetInputImage()->GetExtent(ext);
46 maxX = ext[1]-ext[0]+1;
47 maxY = ext[3]-ext[2]+1;
48 maxZ = ext[5]-ext[4]+1;
52 if (bbGetInputWithSpacing()==true)
66 if ( (px>=0) && (px<maxX) && (py>=0) && (py<maxY) &&(pz>=0) && (pz<maxZ) )
68 grayLevel = bbGetInputImage()->GetScalarComponentAsDouble( px,py,pz,0);
75 std::vector<double> lstGL;
76 std::vector<double> lstX = bbGetInputLstPointsX();
77 std::vector<double> lstY = bbGetInputLstPointsY();
78 std::vector<double> lstZ = bbGetInputLstPointsZ();
79 if ( (lstX.size()==lstY.size()) && (lstY.size()==lstZ.size()) )
81 long int i,size=lstX.size();
84 if (bbGetInputWithSpacing()==true)
98 if ( (px>=0) && (px<maxX) && (py>=0) && (py<maxY) &&(pz>=0) && (pz<maxZ) )
100 lstGL.push_back( bbGetInputImage()->GetScalarComponentAsDouble( px, py,pz,0) );
102 lstGL.push_back( -9991 );
106 bbSetOutputLstGrayLevel(lstGL);
109 bbSetOutputGrayLevel(grayLevel);
111 printf ("EED GrayLevel::Process End\n");
116 // 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)
118 void GrayLevel::bbUserSetDefaultValues()
120 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
121 // Here we initialize the input 'In' to 0
122 bbSetInputImage(NULL);
123 bbSetInputWithSpacing(false);
126 // 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)
128 void GrayLevel::bbUserInitializeProcessing()
131 // THE INITIALIZATION METHOD BODY :
133 // but this is where you should allocate the internal/output pointers
139 // 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)
141 void GrayLevel::bbUserFinalizeProcessing()
144 // THE FINALIZATION METHOD BODY :
146 // but this is where you should desallocate the internal/output pointers
151 // EO namespace bbcreaVtk