From 4f2b02449cf03ee45a0ee6773f31dad2c85e14bc Mon Sep 17 00:00:00 2001 From: espinosa Date: Mon, 13 Jul 2015 12:01:04 +0200 Subject: [PATCH] #2676 creaVtk Feature New Normal - New GrayLevel --- bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx | 78 +++++++++++++++++++ bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.h | 49 ++++++++++++ .../src/bbcreaVtkVectorsExtraction.cxx | 29 ++----- .../src/bbcreaVtkVectorsExtraction.h | 2 +- 4 files changed, 134 insertions(+), 24 deletions(-) create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.h diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx new file mode 100644 index 0000000..959c59c --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.cxx @@ -0,0 +1,78 @@ +//===== +// 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 "bbcreaVtkGrayLevel.h" +#include "bbcreaVtkPackage.h" +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,GrayLevel) +BBTK_BLACK_BOX_IMPLEMENTATION(GrayLevel,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 GrayLevel::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') + vtkImageData *m_image = vtkImageData::New(); + m_image = bbGetInputImage(); + + int grayLevel = 0; + std::vector coord = bbGetInputCoordinate(); + + grayLevel = m_image->GetScalarComponentAsDouble(coord[0],coord[1],coord[2],0); + + bbSetOutputGrayLevel(grayLevel); + +} +//===== +// 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 GrayLevel::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputImage(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 GrayLevel::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 GrayLevel::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/bbcreaVtkGrayLevel.h b/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.h new file mode 100644 index 0000000..20e06f8 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkGrayLevel.h @@ -0,0 +1,49 @@ +//===== +// 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 __bbcreaVtkGrayLevel_h_INCLUDED__ +#define __bbcreaVtkGrayLevel_h_INCLUDED__ +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkImageData.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT GrayLevel + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(GrayLevel,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(Image,vtkImageData*); + BBTK_DECLARE_INPUT(Coordinate,std::vector); + BBTK_DECLARE_OUTPUT(GrayLevel,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(GrayLevel,bbtk::AtomicBlackBox); +BBTK_NAME("GrayLevel"); +BBTK_AUTHOR("Monica ESPINOSA"); +BBTK_DESCRIPTION("No Description."); +BBTK_CATEGORY("empty"); +BBTK_INPUT(GrayLevel,Image,"Image",vtkImageData*,""); +BBTK_INPUT(GrayLevel,Coordinate,"Coordinate Of Point ",std::vector,""); +BBTK_OUTPUT(GrayLevel,GrayLevel,"GrayLevel",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(GrayLevel); +//===== +// 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 // __bbcreaVtkGrayLevel_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx index e410bb9..f26075e 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.cxx @@ -35,40 +35,23 @@ void VectorsExtraction::Process() 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")); - - - + velocity = vtkDoubleArray::SafeDownCast(m_VectorImage->GetPointData()->GetArray("velocity")); - std::cout << "coord: "<< coord[0] << ","<< coord[1] << ","<GetNumberOfComponents()<Print(std::cout); - - - - - //bbSetOutputAngle1(ang1); - //bbSetOutputAngle2(ang2); + bbSetOutputAngle1(ang1); + bbSetOutputAngle2(ang2); }// if image != NULL - - - - - - std::cout<< "MLER VectorsExtraction Process END" << std::endl; } diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h index e31fb35..246e09b 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVectorsExtraction.h @@ -9,7 +9,7 @@ #include "vtkImageData.h" -#include "vtkPolyData.h" +#include "vtkPointData.h" namespace bbcreaVtk { -- 2.47.1