]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx
f26075e66e2bc69f0f0034a946485606b7004ddc
[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                 vtkDoubleArray* velocity = vtkDoubleArray::New();
39                 velocity = vtkDoubleArray::SafeDownCast(m_VectorImage->GetPointData()->GetArray("velocity"));
40
41                 std::cout<< "# components velocity" << velocity->GetNumberOfComponents()<<std::endl;
42
43                 double ang1 = 0;
44                 double ang2 = 0;
45
46                 ang1 = 1;
47                 ang2 = 2;
48                 m_VectorImage->Print(std::cout);
49
50                 bbSetOutputAngle1(ang1);
51                 bbSetOutputAngle2(ang2);
52
53         }// if image != NULL
54     
55     std::cout<< "MLER VectorsExtraction Process END" << std::endl;
56   
57 }
58 //===== 
59 // 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)
60 //===== 
61 void VectorsExtraction::bbUserSetDefaultValues()
62 {
63
64 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
65 //    Here we initialize the input 'In' to 0
66    bbSetInputVectorsFieldImage(NULL);
67   
68 }
69 //===== 
70 // 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)
71 //===== 
72 void VectorsExtraction::bbUserInitializeProcessing()
73 {
74
75 //  THE INITIALIZATION METHOD BODY :
76 //    Here does nothing 
77 //    but this is where you should allocate the internal/output pointers 
78 //    if any 
79
80   
81 }
82 //===== 
83 // 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)
84 //===== 
85 void VectorsExtraction::bbUserFinalizeProcessing()
86 {
87
88 //  THE FINALIZATION METHOD BODY :
89 //    Here does nothing 
90 //    but this is where you should desallocate the internal/output pointers 
91 //    if any
92   
93 }
94 }
95 // EO namespace bbcreaVtk
96
97