From: ctorres Date: Mon, 7 Jul 2014 14:31:51 +0000 (+0200) Subject: 2428 creaVtk Feature New Normal New Black Box vtkImageContinuousErode3D with repetiti... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cc46a640a6898f86ff194670b6c41bdc4398971a;p=creaVtk.git 2428 creaVtk Feature New Normal New Black Box vtkImageContinuousErode3D with repetitions 2014-07-07 16:30 --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx new file mode 100644 index 0000000..95fd998 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx @@ -0,0 +1,55 @@ + +#include "bbcreaVtkImageContinuousErode3D.h" +#include "bbcreaVtkPackage.h" +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageContinuousErode3D) +BBTK_BLACK_BOX_IMPLEMENTATION(ImageContinuousErode3D,bbtk::AtomicBlackBox); + +void ImageContinuousErode3D::Process() +{ + vtkImageData* result = erodeFilterRecursive(bbGetInputImage(), bbGetInputRepetitions(), bbGetInputX(),bbGetInputY(),bbGetInputZ()); + bbSetOutputOut(result); +} + +vtkImageData* ImageContinuousErode3D::erodeFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z) +{ + vtkImageContinuousErode3D *erodeFilter = vtkImageContinuousErode3D ::New(); + erodeFilter->SetInput (image); + erodeFilter->SetKernelSize(x, y, z); + erodeFilter->Modified(); + erodeFilter->Update(); + vtkImageData* resultRec; + if(repetitions == 0) + { + resultRec = erodeFilter->GetOutput(); + return resultRec; + } + else { + vtkImageData* resultRec = erodeFilterRecursive(erodeFilter->GetOutput(), (repetitions-1), x, y, z); + } +} + +void ImageContinuousErode3D::bbUserSetDefaultValues() +{ + +} +//===== +// 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 ImageContinuousErode3D::bbUserInitializeProcessing() +{ + +} +//===== +// 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 ImageContinuousErode3D::bbUserFinalizeProcessing() +{ + +} +} +// EO namespace bbcreaVtk + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.h b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.h new file mode 100644 index 0000000..ed6810a --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.h @@ -0,0 +1,56 @@ +//===== +// 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 __bbcreaVtkImageContinuousErode3D_h_INCLUDED__ +#define __bbcreaVtkImageContinuousErode3D_h_INCLUDED__ +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" +#include "vtkImageData.h" +#include "vtkImageContinuousErode3D.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT ImageContinuousErode3D + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ImageContinuousErode3D,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* erodeFilterRecursive(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(ImageContinuousErode3D,bbtk::AtomicBlackBox); +BBTK_NAME("ImageContinuousErode3D"); +BBTK_AUTHOR("Carlos Torres"); +BBTK_DESCRIPTION("No Description."); +BBTK_CATEGORY("empty"); +BBTK_INPUT(ImageContinuousErode3D,X,"X",double,""); +BBTK_INPUT(ImageContinuousErode3D,Y,"Y",double,""); +BBTK_INPUT(ImageContinuousErode3D,Z,"Z",double,""); +BBTK_INPUT(ImageContinuousErode3D,Repetitions,"Repetitions",int,""); +BBTK_INPUT(ImageContinuousErode3D,Image,"Image input",vtkImageData*,""); +BBTK_OUTPUT(ImageContinuousErode3D,Out,"Image output",vtkImageData*,""); +BBTK_END_DESCRIBE_BLACK_BOX(ImageContinuousErode3D); +//===== +// 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 // __bbcreaVtkImageContinuousErode3D_h_INCLUDED__ +