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 "bbvtkTemporalPicker.h"
5 #include "bbvtkPackage.h"
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,TemporalPicker)
10 BBTK_BLACK_BOX_IMPLEMENTATION(TemporalPicker,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 TemporalPicker::Process()
17 // THE MAIN PROCESSING METHOD BODY
18 // Here we simply set the input 'In' value to the output 'Out'
19 // And print out the output value
20 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
21 // void bbSet{Input|Output}NAME(const TYPE&)
22 // const TYPE& bbGet{Input|Output}NAME() const
24 // * NAME is the name of the input/output
25 // (the one provided in the attribute 'name' of the tag 'input')
26 // * TYPE is the C++ type of the input/output
27 // (the one provided in the attribute 'type' of the tag 'input')
30 std::vector<double> result;
31 if (bbGetInputIn()!=NULL)
34 int sizeX,sizeY,sizeZ;
35 bbGetInputIn()->GetWholeExtent(ext);
36 sizeX=ext[1]-ext[0]+1;
37 sizeY=ext[3]-ext[2]+1;
38 sizeZ=ext[5]-ext[4]+1;
40 if (bbGetInputPoint().size()>=2)
42 int px=bbGetInputPoint()[0];
43 int py=bbGetInputPoint()[1];
44 int pz=bbGetInputPoint()[2];
46 if ((px>=0) && (px<sizeX) && (py>=0) && (py<sizeY) )
49 int minX,maxX,minY,maxY;
51 minX=px-bbGetInputSizeRegion()-1;
52 maxX=px+bbGetInputSizeRegion()-1;
53 minY=py-bbGetInputSizeRegion()-1;
54 maxY=py+bbGetInputSizeRegion()-1;
59 for(i=minX;i<=maxX;i++)
61 for(j=minY;j<=maxY;j++)
63 if ((i>=0) && (i<sizeX) && (j>=0) && (j<sizeY) )
65 acum = acum + bbGetInputIn()->GetScalarComponentAsDouble(i, j, k, 0);
73 result.push_back( acum/numElem );
75 result.push_back( 0 );
80 } else {// bbGetInputPoint
81 printf("ERROR: Input:Point is not good defined in TemporalPicker Box..\n ");
83 } else {// bbGetInputIn
84 printf("ERROR: Missing Input:In vtkImageData* in TemporalPicker Box..\n ");
87 bbSetOutputOut(result);
90 // 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)
92 void TemporalPicker::bbUserSetDefaultValues()
95 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
96 // Here we initialize the input 'In' to 0
98 bbSetInputSizeRegion(1);
102 // 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)
104 void TemporalPicker::bbUserInitializeProcessing()
107 // THE INITIALIZATION METHOD BODY :
109 // but this is where you should allocate the internal/output pointers
115 // 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)
117 void TemporalPicker::bbUserFinalizeProcessing()
120 // THE FINALIZATION METHOD BODY :
122 // but this is where you should desallocate the internal/output pointers
127 // EO namespace bbvtk