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)
14 void ManualPaint_Model::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')
28 // bbSetOutputOut( bbGetInputIn() );
29 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
31 if (bbGetInputImage()!=NULL)
33 manualpaintmodel->SetActive( bbGetInputActive() );
34 manualpaintmodel->SetTool( bbGetInputTool() );
35 manualpaintmodel->Set2D3D( bbGetInput2D3D() );
36 manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
37 manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
38 manualpaintmodel->SetDirection( bbGetInputDirection() );
39 manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
40 manualpaintmodel->SetBrushForm( bbGetInputBrushForm() );
41 manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() );
42 manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );
43 manualpaintmodel->SetRangeMin( bbGetInputRange()[0] );
44 manualpaintmodel->SetRangeMax( bbGetInputRange()[1] );
45 if (bbGetInputPoint().size()==3)
47 manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
50 if ( bbGetInputByLstPointsX().size()!=0 )
52 int i,size = bbGetInputByLstPointsX().size();
55 manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
59 if (bbGetInputByImagePoints()!=NULL)
65 bbGetInputByImagePoints()->GetWholeExtent(ext);
66 int dimX=ext[1]-ext[0]+1;
67 int dimY=ext[3]-ext[2]+1;
68 int dimZ=ext[5]-ext[4]+1;
73 printf("ManualPaint_Model %d%\n", (int)(i*100.0/dimX) );
79 if ( bbGetInputByImagePoints()->GetScalarComponentAsDouble(i,j,k, 0)>0)
81 if (bbGetInputImage2()->GetScalarComponentAsDouble(i,j,k, 0)==0)
83 manualpaintmodel->PaintImage(i,j,k);
85 } // GetScalarComponentAsDouble
89 printf("ManualPaint_Model %d%\n", 100 );
92 printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
95 if (bbGetInputImage2()!=NULL)
97 bbSetOutputOut( bbGetInputImage2() );
98 } else if (bbGetInputImage()!=NULL) {
99 bbSetOutputOut( bbGetInputImage() );
101 bbSetOutputOut( NULL );
105 // 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)
107 void ManualPaint_Model::bbUserSetDefaultValues()
110 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
111 // Here we initialize the input 'In' to 0
113 bbSetInputActive(true);
114 bbSetInputTool(1); // Paint
115 bbSetInput2D3D(1); // 3D
116 bbSetInputImage(NULL);
117 bbSetInputImage2(NULL);
118 bbSetInputGrayLevel(100);
119 bbSetInputDirection(2); // XY
120 bbSetInputBrushSize(3);
121 bbSetInputBrushForm(1); // sphere
122 bbSetInputToleranceFill(50);
123 bbSetInputDistanceFill(25);
125 std::vector<int> point;
129 bbSetInputPoint(point);
131 std::vector<double> range;
133 range.push_back(200);
134 bbSetInputRange(range);
136 bbSetInputByImagePoints(NULL);
140 // 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)
142 void ManualPaint_Model::bbUserInitializeProcessing()
145 // THE INITIALIZATION METHOD BODY :
147 // but this is where you should allocate the internal/output pointers
150 manualpaintmodel=new ManualPaintModel();
155 // 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)
157 void ManualPaint_Model::bbUserFinalizeProcessing()
160 // THE FINALIZATION METHOD BODY :
162 // but this is where you should desallocate the internal/output pointers
164 delete manualpaintmodel;
169 // EO namespace bbcreaMaracasVisu