From 4cad1b11d2325f89911b061915750ca20c7cfeaa Mon Sep 17 00:00:00 2001 From: espinosa Date: Thu, 9 Jul 2015 17:55:03 +0200 Subject: [PATCH] #2671 creaVtk Feature New Normal - VectorsExtraction --- .../src/bbcreaVtkVectorsExtraction.cxx | 114 ++++++++++++++++++ .../src/bbcreaVtkVectorsExtraction.h | 54 +++++++++ 2 files changed, 168 insertions(+) create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx new file mode 100644 index 0000000..e410bb9 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx @@ -0,0 +1,114 @@ +//===== +// 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(); + + std::vector coord = bbGetInputCoordinates(); + + /*double *vector = static_cast(m_VectorImage->GetScalarPointer(coord[0],coord[1],coord[2])); + + vtkDoubleArray* velocity = vtkDoubleArray::New(); + velocity = vtkDoubleArray::SafeDownCast(this->m_VectorImage->GetPointData()->GetArray("velocity")); + + + + + std::cout << "coord: "<< coord[0] << ","<< coord[1] << ","<Print(std::cout); + + + + + + //bbSetOutputAngle1(ang1); + //bbSetOutputAngle2(ang2); + + }// 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 + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h new file mode 100644 index 0000000..e31fb35 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h @@ -0,0 +1,54 @@ +//===== +// 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) +//===== +#ifndef __bbcreaVtkVectorsExtraction_h_INCLUDED__ +#define __bbcreaVtkVectorsExtraction_h_INCLUDED__ +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkImageData.h" + +#include "vtkPolyData.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT VectorsExtraction + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(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) +//===== + BBTK_DECLARE_INPUT(Coordinates,std::vector); + BBTK_DECLARE_INPUT(VectorsFieldImage,vtkImageData*); + BBTK_DECLARE_OUTPUT(Vector,std::vector); + BBTK_DECLARE_OUTPUT(Angle1,double); + BBTK_DECLARE_OUTPUT(Angle2,double); + BBTK_PROCESS(Process); + void Process(); +//===== +// 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) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorsExtraction,bbtk::AtomicBlackBox); +BBTK_NAME("VectorsExtraction"); +BBTK_AUTHOR("Monica ESPINOSA"); +BBTK_DESCRIPTION("No Description."); +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,Angle1,"Angle 1 (Helix Angle)",double,""); +BBTK_OUTPUT(VectorsExtraction,Angle2,"Angle 2 (Transversal Angle)",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(VectorsExtraction); +//===== +// 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) +//===== +} +// EO namespace bbcreaVtk + +#endif // __bbcreaVtkVectorsExtraction_h_INCLUDED__ + -- 2.45.0