//===== // 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) //===== #include "bbcreaVtkVectorsExtraction.h" #include "bbcreaVtkPackage.h" #include "vtkDoubleArray.h" namespace bbcreaVtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VectorsExtraction) BBTK_BLACK_BOX_IMPLEMENTATION(VectorsExtraction,bbtk::AtomicBlackBox); //===== // 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) //===== void VectorsExtraction::Process() { // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value // INPUT/OUTPUT ACCESSORS ARE OF THE FORM : // void bbSet{Input|Output}NAME(const TYPE&) // const TYPE& bbGet{Input|Output}NAME() const // Where : // * NAME is the name of the input/output // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') std::cout<< "MLER VectorsExtraction Process Start" << std::endl; if(bbGetInputVectorsFieldImage() != NULL ) { vtkImageData *m_VectorImage = bbGetInputVectorsFieldImage(); vtkIdType m_idType; vtkDoubleArray *velocity = vtkDoubleArray::New(); std::vector coord = bbGetInputCoordinates(); std::vector vec; vec.push_back(0); vec.push_back(0); vec.push_back(0); double ang1 = 0;//Angle 1 double ang2 = 0;//ANgle 2 double comp = 0;//Component x + y //Find coordinate into the image m_idType = m_VectorImage->FindPoint(coord[0],coord[1],coord[2]); std::cout << m_idType; //Recuperate vector of vectorFieldImage velocity = vtkDoubleArray::SafeDownCast(m_VectorImage->GetPointData()->GetArray("velocity")); //velocity->Print(std::cout); std::cout<< "# components velocity: " << velocity->GetNumberOfComponents()<GetNumberOfTuples()<GetComponent(m_idType,0); vec[1] = velocity->GetComponent(m_idType,1); vec[2] = velocity->GetComponent(m_idType,2); std::cout << "velocity :" << vec[0] << "," <Print(std::cout); std::cout << "ang1: " << ang1 << std::endl; std::cout << "ang2: " << ang2 << std::endl; bbSetOutputAngle1(ang1); bbSetOutputAngle2(ang2); bbSetOutputVector(vec); bbSetOutputX(coord[0]); bbSetOutputY(coord[1]); bbSetOutputZ(coord[2]); }// if image != NULL std::cout<< "MLER VectorsExtraction Process END" << std::endl; } //===== // 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) //===== void VectorsExtraction::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputVectorsFieldImage(NULL); } //===== // 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) //===== void VectorsExtraction::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any } //===== // 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) //===== void VectorsExtraction::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbcreaVtk