]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx
#2864 creaMaracasVisu Feature New Normal - Manual Paint , modifies external image...
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuManualPaint_Model.cxx
1 //===== 
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)
3 //===== 
4 #include "bbcreaMaracasVisuManualPaint_Model.h"
5 #include "bbcreaMaracasVisuPackage.h"
6 namespace bbcreaMaracasVisu
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_Model)
10 BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_Model,bbtk::AtomicBlackBox);
11 //===== 
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)
13 //===== 
14 void ManualPaint_Model::Process()
15 {
16
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 
23 //    Where :
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;
30
31         if (bbGetInputImage()!=NULL)
32         {  
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                 manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
46          } else {
47                 printf("EED Warning: Image not set. Box creaMaracasVisu::ManualPaint_Model (BBTK) \n");
48         } // if 
49 //      manualpaintmodel-> GetScalarRange(double * range);
50 //      manualpaintmodel-> SetUndoImage(); //DFCH
51 //      manualpaintmodel-> Undo(); //DFCH
52 //      manualpaintmodel-> Redo(); //DFCH
53
54
55
56 }
57 //===== 
58 // 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)
59 //===== 
60 void ManualPaint_Model::bbUserSetDefaultValues()
61 {
62
63 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
64 //    Here we initialize the input 'In' to 0
65
66         bbSetInputActive(true);
67         bbSetInputTool(1);  // Paint
68         bbSetInput2D3D(1);  // 3D
69         bbSetInputImage(NULL);
70         bbSetInputImage2(NULL);
71         bbSetInputGrayLevel(100);
72         bbSetInputDirection(2); // XY
73         bbSetInputBrushSize(3);
74         bbSetInputBrushForm(1); // sphere
75         bbSetInputToleranceFill(50);
76         bbSetInputDistanceFill(25);
77
78         std::vector<int> point;
79         point.push_back(0);
80         point.push_back(0);
81         point.push_back(0);
82         bbSetInputPoint(point);
83
84         std::vector<double> range;
85         range.push_back(0);
86         range.push_back(200);
87         bbSetInputRange(range);
88   
89 }
90 //===== 
91 // 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 //===== 
93 void ManualPaint_Model::bbUserInitializeProcessing()
94 {
95
96 //  THE INITIALIZATION METHOD BODY :
97 //    Here does nothing 
98 //    but this is where you should allocate the internal/output pointers 
99 //    if any 
100
101         manualpaintmodel=new ManualPaintModel();
102
103   
104 }
105 //===== 
106 // 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 //===== 
108 void ManualPaint_Model::bbUserFinalizeProcessing()
109 {
110
111 //  THE FINALIZATION METHOD BODY :
112 //    Here does nothing 
113 //    but this is where you should desallocate the internal/output pointers 
114 //    if any
115         delete manualpaintmodel;
116   
117 }
118
119 }
120 // EO namespace bbcreaMaracasVisu
121
122