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)
5 #include "creaVtk_MACROS.h"
6 #include "bbcreaMaracasVisuManualPaint_Model.h"
7 #include "bbcreaMaracasVisuPackage.h"
10 namespace bbcreaMaracasVisu
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_Model)
14 BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_Model,bbtk::AtomicBlackBox);
16 // 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)
20 void ManualPaint_Model::Process()
23 // THE MAIN PROCESSING METHOD BODY
24 // Here we simply set the input 'In' value to the output 'Out'
25 // And print out the output value
26 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
27 // void bbSet{Input|Output}NAME(const TYPE&)
28 // const TYPE& bbGet{Input|Output}NAME() const
30 // * NAME is the name of the input/output
31 // (the one provided in the attribute 'name' of the tag 'input')
32 // * TYPE is the C++ type of the input/output
33 // (the one provided in the attribute 'type' of the tag 'input')
34 // bbSetOutputOut( bbGetInputIn() );
35 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
37 if (bbGetInputImage()!=NULL)
39 manualpaintmodel->SetActive( bbGetInputActive() );
40 manualpaintmodel->SetTool( bbGetInputTool() );
41 manualpaintmodel->Set2D3D( bbGetInput2D3D() );
42 manualpaintmodel->SetImages( bbGetInputImage(),bbGetInputImage2() );
43 manualpaintmodel->SetGrayLevel( bbGetInputGrayLevel() );
44 manualpaintmodel->SetDirection( bbGetInputDirection() );
45 manualpaintmodel->SetBrushSize( bbGetInputBrushSize() );
46 manualpaintmodel->SetBrushForm( bbGetInputBrushForm() );
47 manualpaintmodel->SetToleranceFill( bbGetInputToleranceFill() );
48 manualpaintmodel->SetDistanceFill( bbGetInputDistanceFill() );
49 manualpaintmodel->SetRangeMin( bbGetInputRange()[0] );
50 manualpaintmodel->SetRangeMax( bbGetInputRange()[1] );
51 if (bbGetInputPoint().size()==3)
53 manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
55 if ( bbGetInputByLstPointsX().size()!=0 )
57 int i,size = bbGetInputByLstPointsX().size();
60 manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
63 if ((bbGetInputByImagePoints()!=NULL) && (bbGetInputImage2()!=NULL) )
68 //EED 2017-01-01 Migration VTK7
69 #if VTK_MAJOR_VERSION <= 5
70 bbGetInputByImagePoints()->GetWholeExtent(ext);
72 bbGetInputByImagePoints()->GetExtent(ext);
74 int dimX=ext[1]-ext[0]+1;
75 int dimY=ext[3]-ext[2]+1;
76 int dimZ=ext[5]-ext[4]+1;
77 DEF_POINTER_IMAGE_VTK_CREA(vBIP,sSBIP,pBIP,sTBIP,bbGetInputByImagePoints());
78 DEF_POINTER_IMAGE_VTK_CREA(vI2,sSI2,pI2,sTI2,bbGetInputImage2());
79 //#pragma omp parallel for
85 printf("ManualPaint_Model %d%\n", (int)(k*100.0/dimZ) );
91 GETVALUE_VTK_CREA(vBIP,pBIP,sTBIP)
94 GETVALUE_VTK_CREA(vI2,pI2,sTI2)
97 manualpaintmodel->PaintImage(i,j,k);
105 printf("ManualPaint_Model %d%\n", 100 );
106 } // if ByImagePoints
108 printf("EED Warning: ByImagePoints or Image2 not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
109 } // if ((bbGetInputByImagePoints()!=NULL) && (bbGetInputImage2()!=NULL) )
111 if (bbGetInputImage2()!=NULL)
113 bbSetOutputOut( bbGetInputImage2() );
114 } else if (bbGetInputImage()!=NULL) {
115 bbSetOutputOut( bbGetInputImage() );
117 bbSetOutputOut( NULL );
121 // 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)
123 void ManualPaint_Model::bbUserSetDefaultValues()
126 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
127 // Here we initialize the input 'In' to 0
129 bbSetInputActive(true);
130 bbSetInputTool(1); // Paint
131 bbSetInput2D3D(1); // 3D
132 bbSetInputImage(NULL);
133 bbSetInputImage2(NULL);
134 bbSetInputGrayLevel(100);
135 bbSetInputDirection(2); // XY
136 bbSetInputBrushSize(3);
137 bbSetInputBrushForm(1); // sphere
138 bbSetInputToleranceFill(50);
139 bbSetInputDistanceFill(25);
140 std::vector<int> point;
144 bbSetInputPoint(point);
145 std::vector<double> range;
147 range.push_back(200);
148 bbSetInputRange(range);
149 bbSetInputByImagePoints(NULL);
152 // 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)
154 void ManualPaint_Model::bbUserInitializeProcessing()
157 // THE INITIALIZATION METHOD BODY :
159 // but this is where you should allocate the internal/output pointers
162 manualpaintmodel=new ManualPaintModel();
167 // 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)
169 void ManualPaint_Model::bbUserFinalizeProcessing()
172 // THE FINALIZATION METHOD BODY :
174 // but this is where you should desallocate the internal/output pointers
176 delete manualpaintmodel;
181 // EO namespace bbcreaMaracasVisu