]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx
#2671 creaVtk Feature New Normal - VectorsExtraction
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkVectorsExtraction.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 "bbcreaVtkVectorsExtraction.h"
5 #include "bbcreaVtkPackage.h"
6 #include "vtkDoubleArray.h"
7
8 namespace bbcreaVtk
9 {
10
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VectorsExtraction)
12 BBTK_BLACK_BOX_IMPLEMENTATION(VectorsExtraction,bbtk::AtomicBlackBox);
13 //===== 
14 // 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)
15 //===== 
16 void VectorsExtraction::Process()
17 {
18
19 // THE MAIN PROCESSING METHOD BODY
20 //   Here we simply set the input 'In' value to the output 'Out'
21 //   And print out the output value
22 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
23 //    void bbSet{Input|Output}NAME(const TYPE&)
24 //    const TYPE& bbGet{Input|Output}NAME() const 
25 //    Where :
26 //    * NAME is the name of the input/output
27 //      (the one provided in the attribute 'name' of the tag 'input')
28 //    * TYPE is the C++ type of the input/output
29 //      (the one provided in the attribute 'type' of the tag 'input')
30     std::cout<< "MLER VectorsExtraction Process Start" << std::endl;
31
32     if(bbGetInputVectorsFieldImage() != NULL )
33         {
34                 vtkImageData* m_VectorImage = bbGetInputVectorsFieldImage();
35
36                 std::vector<double> coord = bbGetInputCoordinates();
37
38                 /*double *vector = static_cast<double*>(m_VectorImage->GetScalarPointer(coord[0],coord[1],coord[2]));
39
40                 vtkDoubleArray* velocity = vtkDoubleArray::New();
41                 velocity = vtkDoubleArray::SafeDownCast(this->m_VectorImage->GetPointData()->GetArray("velocity"));
42
43
44
45
46                 std::cout << "coord: "<< coord[0] << ","<< coord[1] << ","<<coord[2] << std::endl;
47                 std::cout << "vector: "<< velocity[0] << ","<< velocity[1] << ","<<velocityvelocity[2] << std::endl;
48
49                 double ang1 = 0;
50                 double ang2 = 0;
51
52                 ang1 = velocity[0] + velocity[1] + velocity[2];
53                 ang2 = velocity[0] + velocity[1] - velocity[2];
54 */
55                 m_VectorImage->Print(std::cout);
56
57
58
59
60
61                 //bbSetOutputAngle1(ang1);
62                 //bbSetOutputAngle2(ang2);
63
64         }// if image != NULL
65     
66
67     
68
69
70
71
72     std::cout<< "MLER VectorsExtraction Process END" << std::endl;
73   
74 }
75 //===== 
76 // 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)
77 //===== 
78 void VectorsExtraction::bbUserSetDefaultValues()
79 {
80
81 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
82 //    Here we initialize the input 'In' to 0
83    bbSetInputVectorsFieldImage(NULL);
84   
85 }
86 //===== 
87 // 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)
88 //===== 
89 void VectorsExtraction::bbUserInitializeProcessing()
90 {
91
92 //  THE INITIALIZATION METHOD BODY :
93 //    Here does nothing 
94 //    but this is where you should allocate the internal/output pointers 
95 //    if any 
96
97   
98 }
99 //===== 
100 // 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)
101 //===== 
102 void VectorsExtraction::bbUserFinalizeProcessing()
103 {
104
105 //  THE FINALIZATION METHOD BODY :
106 //    Here does nothing 
107 //    but this is where you should desallocate the internal/output pointers 
108 //    if any
109   
110 }
111 }
112 // EO namespace bbcreaVtk
113
114