From 4007885792319de462fdb912c02c21fa15cf4f6c Mon Sep 17 00:00:00 2001 From: ctorres Date: Mon, 7 Jul 2014 12:05:36 +0200 Subject: [PATCH] 2426 creaVtk Feature New Normal New Black Box vtkImageContinuousDilate3D with repetitions 2014-07-07 12:05 --- .../src/bbcreaVtkImageContinuousDilate3D.cxx | 58 +++++++++++++++++++ .../src/bbcreaVtkImageContinuousDilate3D.h | 57 ++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.h diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx new file mode 100644 index 0000000..815f029 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx @@ -0,0 +1,58 @@ + +#include "bbcreaVtkImageContinuousDilate3D.h" +#include "bbcreaVtkPackage.h" +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageContinuousDilate3D) +BBTK_BLACK_BOX_IMPLEMENTATION(ImageContinuousDilate3D,bbtk::AtomicBlackBox); + +void ImageContinuousDilate3D::Process() +{ + vtkImageData* result = dilateFilterRecursive(bbGetInputImage(), bbGetInputRepetitions(), bbGetInputX(),bbGetInputY(),bbGetInputZ()); + bbSetOutputOut(result); +} + +vtkImageData* ImageContinuousDilate3D::dilateFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z) +{ + vtkImageContinuousDilate3D *dilateFilter = vtkImageContinuousDilate3D ::New(); + dilateFilter->SetInput (image); + dilateFilter->SetKernelSize(x, y, z); + dilateFilter->Modified(); + dilateFilter->Update(); + vtkImageData* resultRec; + if(repetitions == 0) + { + resultRec = dilateFilter->GetOutput(); + return resultRec; + } + else { + vtkImageData* resultRec = dilateFilterRecursive(dilateFilter->GetOutput(), (repetitions-1), x, y, z); + } +} + +void ImageContinuousDilate3D::bbUserSetDefaultValues() +{ + + +} + +void ImageContinuousDilate3D::bbUserInitializeProcessing() +{ + + +} + +void ImageContinuousDilate3D::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/bbcreaVtkImageContinuousDilate3D.h b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.h new file mode 100644 index 0000000..c6e2a8b --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.h @@ -0,0 +1,57 @@ +//===== +// 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 __bbcreaVtkImageContinuousDilate3D_h_INCLUDED__ +#define __bbcreaVtkImageContinuousDilate3D_h_INCLUDED__ +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" +#include "vtkImageData.h" +#include "vtkImageContinuousDilate3D.h" +#include "vtkSmartPointer.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT ImageContinuousDilate3D + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ImageContinuousDilate3D,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(X,double); + BBTK_DECLARE_INPUT(Y,double); + BBTK_DECLARE_INPUT(Z,double); + BBTK_DECLARE_INPUT(Repetitions,int); + BBTK_DECLARE_INPUT(Image,vtkImageData*); + BBTK_DECLARE_OUTPUT(Out,vtkImageData*); + BBTK_PROCESS(Process); + void Process(); + vtkImageData* dilateFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z); +//===== +// 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(ImageContinuousDilate3D,bbtk::AtomicBlackBox); +BBTK_NAME("ImageContinuousDilate3D"); +BBTK_AUTHOR("Carlos Torres"); +BBTK_DESCRIPTION("No Description."); +BBTK_CATEGORY("empty"); +BBTK_INPUT(ImageContinuousDilate3D,X,"X",double,""); +BBTK_INPUT(ImageContinuousDilate3D,Y,"Y",double,""); +BBTK_INPUT(ImageContinuousDilate3D,Z,"Z",double,""); +BBTK_INPUT(ImageContinuousDilate3D,Repetitions,"Repetitions",int,""); +BBTK_INPUT(ImageContinuousDilate3D,Image,"Image input",vtkImageData*,""); +BBTK_OUTPUT(ImageContinuousDilate3D,Out,"Image output",vtkImageData*,""); +BBTK_END_DESCRIBE_BLACK_BOX(ImageContinuousDilate3D); +//===== +// 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 // __bbcreaVtkImageContinuousDilate3D_h_INCLUDED__ + -- 2.47.1