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 "bbcreaMaracasVisuManualPaint_Model.h"
5 #include "bbcreaMaracasVisuPackage.h"
6 namespace bbcreaMaracasVisu
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_Model)
10 BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_Model,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)
17 void ManualPaint_Model::Process()
20 // THE MAIN PROCESSING METHOD BODY
21 // Here we simply set the input 'In' value to the output 'Out'
22 // And print out the output value
23 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
24 // void bbSet{Input|Output}NAME(const TYPE&)
25 // const TYPE& bbGet{Input|Output}NAME() const
27 // * NAME is the name of the input/output
28 // (the one provided in the attribute 'name' of the tag 'input')
29 // * TYPE is the C++ type of the input/output
30 // (the one provided in the attribute 'type' of the tag 'input')
31 // bbSetOutputOut( bbGetInputIn() );
32 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
34 if (bbGetInputImage()!=NULL)
36 manualpaintmodel->SetActive( bbGetInputActive() );
37 manualpaintmodel->SetTool( bbGetInputTool() );
38 manualpaintmodel->Set2D3D( bbGetInput2D3D() );
39 manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
40 manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
41 manualpaintmodel->SetDirection( bbGetInputDirection() );
42 manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
43 manualpaintmodel->SetBrushForm( bbGetInputBrushForm() );
44 manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() );
45 manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );
46 manualpaintmodel->SetRangeMin( bbGetInputRange()[0] );
47 manualpaintmodel->SetRangeMax( bbGetInputRange()[1] );
48 if (bbGetInputPoint().size()==3)
50 manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
53 if ( bbGetInputByLstPointsX().size()!=0 )
55 int i,size = bbGetInputByLstPointsX().size();
58 manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
62 if (bbGetInputByImagePoints()!=NULL)
69 bbGetInputByImagePoints()->GetWholeExtent(ext);
70 int dimX=ext[1]-ext[0]+1;
71 int dimY=ext[3]-ext[2]+1;
72 int dimZ=ext[5]-ext[4]+1;
73 // char *pByImagePoints = bbGetInputByImagePoints->GetScalarComponent(i,j,k,0);
75 //#pragma omp parallel for
82 printf("ManualPaint_Model %d%\n", (int)(ii*100.0/dimX) );
88 if ( bbGetInputByImagePoints()->GetScalarComponentAsDouble(i,j,k, 0)>0)
90 if (bbGetInputImage2()->GetScalarComponentAsDouble(i,j,k, 0)==0)
92 manualpaintmodel->PaintImage(i,j,k);
94 } // GetScalarComponentAsDouble
98 printf("ManualPaint_Model %d%\n", 100 );
101 printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
104 if (bbGetInputImage2()!=NULL)
106 bbSetOutputOut( bbGetInputImage2() );
107 } else if (bbGetInputImage()!=NULL) {
108 bbSetOutputOut( bbGetInputImage() );
110 bbSetOutputOut( NULL );
117 void ManualPaint_Model::Process()
120 // THE MAIN PROCESSING METHOD BODY
121 // Here we simply set the input 'In' value to the output 'Out'
122 // And print out the output value
123 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
124 // void bbSet{Input|Output}NAME(const TYPE&)
125 // const TYPE& bbGet{Input|Output}NAME() const
127 // * NAME is the name of the input/output
128 // (the one provided in the attribute 'name' of the tag 'input')
129 // * TYPE is the C++ type of the input/output
130 // (the one provided in the attribute 'type' of the tag 'input')
131 // bbSetOutputOut( bbGetInputIn() );
132 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
134 if (bbGetInputImage()!=NULL)
136 manualpaintmodel->SetActive( bbGetInputActive() );
137 manualpaintmodel->SetTool( bbGetInputTool() );
138 manualpaintmodel->Set2D3D( bbGetInput2D3D() );
139 manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
140 manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
141 manualpaintmodel->SetDirection( bbGetInputDirection() );
142 manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
143 manualpaintmodel->SetBrushForm( bbGetInputBrushForm() );
144 manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() );
145 manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );
146 manualpaintmodel->SetRangeMin( bbGetInputRange()[0] );
147 manualpaintmodel->SetRangeMax( bbGetInputRange()[1] );
148 if (bbGetInputPoint().size()==3)
150 manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
153 if ( bbGetInputByLstPointsX().size()!=0 )
155 int i,size = bbGetInputByLstPointsX().size();
158 manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
162 if (bbGetInputByImagePoints()!=NULL)
167 bbGetInputByImagePoints()->GetWholeExtent(ext);
168 int dimX=ext[1]-ext[0]+1;
169 int dimY=ext[3]-ext[2]+1;
170 int dimZ=ext[5]-ext[4]+1;
172 DEFINEPOINTERIMAGE_MANUALPAINT(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints());
173 DEFINEPOINTERIMAGE_MANUALPAINT(vI2,sSI2,pI2,sTI2,bbGetInputImage2());
175 //#pragma omp parallel for
182 printf("ManualPaint_Model %d%\n", (int)(k*100.0/dimZ) );
188 GETVALUE_MANUALPAINT(vBIP,pBIP,sTBIP)
191 GETVALUE_MANUALPAINT(vI2,pI2,sTI2)
194 manualpaintmodel->PaintImage(i,j,k);
203 printf("ManualPaint_Model %d%\n", 100 );
204 } // if ByImagePoints
206 printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
209 if (bbGetInputImage2()!=NULL)
211 bbSetOutputOut( bbGetInputImage2() );
212 } else if (bbGetInputImage()!=NULL) {
213 bbSetOutputOut( bbGetInputImage() );
215 bbSetOutputOut( NULL );
219 // 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)
221 void ManualPaint_Model::bbUserSetDefaultValues()
224 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
225 // Here we initialize the input 'In' to 0
227 bbSetInputActive(true);
228 bbSetInputTool(1); // Paint
229 bbSetInput2D3D(1); // 3D
230 bbSetInputImage(NULL);
231 bbSetInputImage2(NULL);
232 bbSetInputGrayLevel(100);
233 bbSetInputDirection(2); // XY
234 bbSetInputBrushSize(3);
235 bbSetInputBrushForm(1); // sphere
236 bbSetInputToleranceFill(50);
237 bbSetInputDistanceFill(25);
239 std::vector<int> point;
243 bbSetInputPoint(point);
245 std::vector<double> range;
247 range.push_back(200);
248 bbSetInputRange(range);
250 bbSetInputByImagePoints(NULL);
254 // 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)
256 void ManualPaint_Model::bbUserInitializeProcessing()
259 // THE INITIALIZATION METHOD BODY :
261 // but this is where you should allocate the internal/output pointers
264 manualpaintmodel=new ManualPaintModel();
269 // 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)
271 void ManualPaint_Model::bbUserFinalizeProcessing()
274 // THE FINALIZATION METHOD BODY :
276 // but this is where you should desallocate the internal/output pointers
278 delete manualpaintmodel;
283 // EO namespace bbcreaMaracasVisu