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 "bbcreaVtkVectorsExtraction.h"
5 #include "bbcreaVtkPackage.h"
6 #include "vtkDoubleArray.h"
12 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VectorsExtraction)
13 BBTK_BLACK_BOX_IMPLEMENTATION(VectorsExtraction,bbtk::AtomicBlackBox);
15 // 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)
17 void VectorsExtraction::Process()
20 // THE MAIN PROCESSING METHOD BODY
21 // Here we simply set the input 'In' value to the output 'Out'
22 // And print out the output value
23 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
24 // void bbSet{Input|Output}NAME(const TYPE&)
25 // const TYPE& bbGet{Input|Output}NAME() const
27 // * NAME is the name of the input/output
28 // (the one provided in the attribute 'name' of the tag 'input')
29 // * TYPE is the C++ type of the input/output
30 // (the one provided in the attribute 'type' of the tag 'input')
31 std::cout<< "MLER VectorsExtraction Process Start" << std::endl;
33 if(bbGetInputVectorsFieldImage() != NULL )
35 vtkImageData *m_VectorImage = bbGetInputVectorsFieldImage();
37 vtkDoubleArray *velocity = vtkDoubleArray::New();
39 std::vector<double> coord = bbGetInputCoordinates();
40 std::vector<double> vec;
46 double ang1 = 0;//Angle 1
47 double ang2 = 0;//ANgle 2
49 //Find coordinate into the image
50 m_idType = m_VectorImage->FindPoint(coord[0],coord[1],coord[2]);
51 std::cout << m_idType;
53 //Recuperate vector of vectorFieldImage
54 velocity = vtkDoubleArray::SafeDownCast(m_VectorImage->GetPointData()->GetArray("velocity"));
55 //velocity->Print(std::cout);
57 std::cout<< "# components velocity: " << velocity->GetNumberOfComponents()<<std::endl;
58 std::cout<< "# tuples velocity: " << velocity->GetNumberOfTuples()<<std::endl;
60 vec[0] = velocity->GetComponent(m_idType,0);
61 vec[1] = velocity->GetComponent(m_idType,1);
62 vec[2] = velocity->GetComponent(m_idType,2);
64 std::cout << "velocity :" << vec[0] << "," <<vec[1] << ","<< vec[2] << std::endl;
67 //Miss calcule of angles -----
71 //m_VectorImage->Print(std::cout);
73 bbSetOutputAngle1(ang1);
74 bbSetOutputAngle2(ang2);
75 bbSetOutputVector(vec);
79 std::cout<< "MLER VectorsExtraction Process END" << std::endl;
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)
85 void VectorsExtraction::bbUserSetDefaultValues()
88 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
89 // Here we initialize the input 'In' to 0
90 bbSetInputVectorsFieldImage(NULL);
94 // 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)
96 void VectorsExtraction::bbUserInitializeProcessing()
99 // THE INITIALIZATION METHOD BODY :
101 // but this is where you should allocate the internal/output pointers
107 // 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)
109 void VectorsExtraction::bbUserFinalizeProcessing()
112 // THE FINALIZATION METHOD BODY :
114 // but this is where you should desallocate the internal/output pointers
119 // EO namespace bbcreaVtk