From d1c64e28802f8db534e9bf17a981cf766d13fa45 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 29 May 2019 14:24:02 +0200 Subject: [PATCH] #3261 creaVtk Feature New Normal - box MagnitudVector --- .../src/bbcreaVtkMagnitudVector.cxx | 133 ++++++++++++++++++ .../src/bbcreaVtkMagnitudVector.h | 55 ++++++++ 2 files changed, 188 insertions(+) create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkMagnitudVector.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkMagnitudVector.h diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMagnitudVector.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMagnitudVector.cxx new file mode 100644 index 0000000..c409205 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMagnitudVector.cxx @@ -0,0 +1,133 @@ +//===== +// 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 "bbcreaVtkMagnitudVector.h" +#include "bbcreaVtkPackage.h" +#include "creaVtk_MACROS.h" +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MagnitudVector) +BBTK_BLACK_BOX_IMPLEMENTATION(MagnitudVector,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 MagnitudVector::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') + +// bbSetOutputOut( bbGetInputIn() ); +// std::cout << "Output value = " <Delete(); + } + imageoutput = vtkImageData::New(); + imageoutput->Initialize(); + imageoutput->SetSpacing( bbGetInputvX()->GetSpacing() ); + int dim[3]; + int ext[6]; +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + bbGetInputvX()->GetWholeExtent(ext ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + bbGetInputvX()->GetExtent(ext ); +#endif + dim[0]=ext[1]-ext[0]+1; + dim[1]=ext[3]-ext[2]+1; + dim[2]=ext[5]-ext[4]+1; + imageoutput->SetDimensions( dim[0], dim[1], dim[2] ); + imageoutput->SetExtent( ext ); +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + imageoutput->SetWholeExtent( ext ); + imageoutput->SetScalarType( VTK_DOUBLE ); + imageoutput->AllocateScalars(); +#endif +#if (VTK_MAJOR_VERSION >= 6) + imageoutput->AllocateScalars( VTK_DOUBLE,1 ); +#endif + + DEF_POINTER_IMAGE_VTK_CREA(vvX,ssvX,pvX,stvX,bbGetInputvX() ) + DEF_POINTER_IMAGE_VTK_CREA(vvY,ssvY,pvY,stvY,bbGetInputvY() ) + DEF_POINTER_IMAGE_VTK_CREA(vvZ,ssvZ,pvZ,stvZ,bbGetInputvZ() ) + DEF_POINTER_IMAGE_VTK_CREA(vOut,ssOut,pOut,stOut,imageoutput ) + long int i, size=dim[0]*dim[1]*dim[2]; +#pragma omp parallel for + for (i=0; i