From deba2ca0e15d275b9c2e80000697d5068ef3efa9 Mon Sep 17 00:00:00 2001 From: espinosa Date: Wed, 15 Jul 2015 12:56:35 +0200 Subject: [PATCH] #2671 creaVtk Feature New Normal - VectorsExtraction --- .../src/bbcreaVtkVectorsExtraction.cxx | 16 ++++++++++++++-- .../src/bbcreaVtkVectorsExtraction.h | 10 +++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx index eae8d67..38f2ffb 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx @@ -45,6 +45,7 @@ void VectorsExtraction::Process() 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]); @@ -65,14 +66,25 @@ void VectorsExtraction::Process() //Miss calcule of angles ----- + comp = sqrt((vec[0]*vec[0])+(vec[1]*vec[1])); + + ang1 = atan2(vec[2],comp) * 180 / PI; - ang1 = vec[0]*80; - ang2 = vec[1]*10; + + ang2 = atan2(vec[1],vec[0]) * 180 / PI; + + //m_VectorImage->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 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h index 621ef3a..d7770f8 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h @@ -8,8 +8,10 @@ #include "iostream" #include "vtkImageData.h" - #include "vtkPointData.h" +#include + +#define PI 3.14159265 namespace bbcreaVtk { @@ -25,6 +27,9 @@ class bbcreaVtk_EXPORT VectorsExtraction BBTK_DECLARE_INPUT(Coordinates,std::vector); BBTK_DECLARE_INPUT(VectorsFieldImage,vtkImageData*); BBTK_DECLARE_OUTPUT(Vector,std::vector); + BBTK_DECLARE_OUTPUT(X,double); + BBTK_DECLARE_OUTPUT(Y,double); + BBTK_DECLARE_OUTPUT(Z,double); BBTK_DECLARE_OUTPUT(Angle1,double); BBTK_DECLARE_OUTPUT(Angle2,double); BBTK_PROCESS(Process); @@ -42,6 +47,9 @@ BBTK_CATEGORY("empty"); BBTK_INPUT(VectorsExtraction,Coordinates,"Coordinates (x,y,z)",std::vector,""); BBTK_INPUT(VectorsExtraction,VectorsFieldImage,"Image of Vectors Field",vtkImageData*,""); BBTK_OUTPUT(VectorsExtraction,Vector,"",std::vector,""); +BBTK_OUTPUT(VectorsExtraction,X,"x",double,""); +BBTK_OUTPUT(VectorsExtraction,Y,"y",double,""); +BBTK_OUTPUT(VectorsExtraction,Z,"z",double,""); BBTK_OUTPUT(VectorsExtraction,Angle1,"Angle 1 (Helix Angle)",double,""); BBTK_OUTPUT(VectorsExtraction,Angle2,"Angle 2 (Transversal Angle)",double,""); BBTK_END_DESCRIBE_BLACK_BOX(VectorsExtraction); -- 2.45.0