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 //EED 2017-01-01 Migration VTK7
66 #if VTK_MAJOR_VERSION <= 5
67 bbGetInputByImagePoints()->GetWholeExtent(ext);
69 bbGetInputByImagePoints()->GetExtent(ext);
72 int dimX=ext[1]-ext[0]+1;
73 int dimY=ext[3]-ext[2]+1;
74 int dimZ=ext[5]-ext[4]+1;
79 printf("ManualPaint_Model %d%\n", (int)(i*100.0/dimX) );
85 if ( bbGetInputByImagePoints()->GetScalarComponentAsDouble(i,j,k, 0)>0)
87 if (bbGetInputImage2()->GetScalarComponentAsDouble(i,j,k, 0)==0)
89 manualpaintmodel->PaintImage(i,j,k);
91 } // GetScalarComponentAsDouble
95 printf("ManualPaint_Model %d%\n", 100 );
98 printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
101 if (bbGetInputImage2()!=NULL)
103 bbSetOutputOut( bbGetInputImage2() );
104 } else if (bbGetInputImage()!=NULL) {
105 bbSetOutputOut( bbGetInputImage() );
107 bbSetOutputOut( NULL );
111 // 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)
113 void ManualPaint_Model::bbUserSetDefaultValues()
116 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
117 // Here we initialize the input 'In' to 0
119 bbSetInputActive(true);
120 bbSetInputTool(1); // Paint
121 bbSetInput2D3D(1); // 3D
122 bbSetInputImage(NULL);
123 bbSetInputImage2(NULL);
124 bbSetInputGrayLevel(100);
125 bbSetInputDirection(2); // XY
126 bbSetInputBrushSize(3);
127 bbSetInputBrushForm(1); // sphere
128 bbSetInputToleranceFill(50);
129 bbSetInputDistanceFill(25);
131 std::vector<int> point;
135 bbSetInputPoint(point);
137 std::vector<double> range;
139 range.push_back(200);
140 bbSetInputRange(range);
142 bbSetInputByImagePoints(NULL);
146 // 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)
148 void ManualPaint_Model::bbUserInitializeProcessing()
151 // THE INITIALIZATION METHOD BODY :
153 // but this is where you should allocate the internal/output pointers
156 manualpaintmodel=new ManualPaintModel();
161 // 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)
163 void ManualPaint_Model::bbUserFinalizeProcessing()
166 // THE FINALIZATION METHOD BODY :
168 // but this is where you should desallocate the internal/output pointers
170 delete manualpaintmodel;
175 // EO namespace bbcreaMaracasVisu