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"
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VectorsExtraction)
12 BBTK_BLACK_BOX_IMPLEMENTATION(VectorsExtraction,bbtk::AtomicBlackBox);
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)
16 void VectorsExtraction::Process()
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
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;
32 if(bbGetInputVectorsFieldImage() != NULL )
34 vtkImageData* m_VectorImage = bbGetInputVectorsFieldImage();
36 std::vector<double> coord = bbGetInputCoordinates();
38 /*double *vector = static_cast<double*>(m_VectorImage->GetScalarPointer(coord[0],coord[1],coord[2]));
40 vtkDoubleArray* velocity = vtkDoubleArray::New();
41 velocity = vtkDoubleArray::SafeDownCast(this->m_VectorImage->GetPointData()->GetArray("velocity"));
46 std::cout << "coord: "<< coord[0] << ","<< coord[1] << ","<<coord[2] << std::endl;
47 std::cout << "vector: "<< velocity[0] << ","<< velocity[1] << ","<<velocityvelocity[2] << std::endl;
52 ang1 = velocity[0] + velocity[1] + velocity[2];
53 ang2 = velocity[0] + velocity[1] - velocity[2];
55 m_VectorImage->Print(std::cout);
61 //bbSetOutputAngle1(ang1);
62 //bbSetOutputAngle2(ang2);
72 std::cout<< "MLER VectorsExtraction Process END" << std::endl;
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)
78 void VectorsExtraction::bbUserSetDefaultValues()
81 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
82 // Here we initialize the input 'In' to 0
83 bbSetInputVectorsFieldImage(NULL);
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)
89 void VectorsExtraction::bbUserInitializeProcessing()
92 // THE INITIALIZATION METHOD BODY :
94 // but this is where you should allocate the internal/output pointers
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)
102 void VectorsExtraction::bbUserFinalizeProcessing()
105 // THE FINALIZATION METHOD BODY :
107 // but this is where you should desallocate the internal/output pointers
112 // EO namespace bbcreaVtk