]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx
2428 creaVtk Feature New Normal New Black Box vtkImageContinuousErode3D with repetiti...
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkImageContinuousErode3D.cxx
1
2 #include "bbcreaVtkImageContinuousErode3D.h"
3 #include "bbcreaVtkPackage.h"
4 namespace bbcreaVtk
5 {
6
7 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageContinuousErode3D)
8 BBTK_BLACK_BOX_IMPLEMENTATION(ImageContinuousErode3D,bbtk::AtomicBlackBox);
9
10 void ImageContinuousErode3D::Process()
11 {
12                 vtkImageData* result = erodeFilterRecursive(bbGetInputImage(), bbGetInputRepetitions(), bbGetInputX(),bbGetInputY(),bbGetInputZ());
13                 bbSetOutputOut(result);
14 }
15
16 vtkImageData* ImageContinuousErode3D::erodeFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z)
17 {
18                 vtkImageContinuousErode3D *erodeFilter = vtkImageContinuousErode3D ::New();
19     erodeFilter->SetInput (image);
20     erodeFilter->SetKernelSize(x, y, z);
21                 erodeFilter->Modified();                
22                 erodeFilter->Update();
23                 vtkImageData* resultRec;
24                 if(repetitions == 0)
25                 {
26                         resultRec = erodeFilter->GetOutput();
27                         return resultRec;
28                 }
29                 else {
30                         vtkImageData* resultRec = erodeFilterRecursive(erodeFilter->GetOutput(), (repetitions-1), x, y, z);
31                 }
32 }
33
34 void ImageContinuousErode3D::bbUserSetDefaultValues()
35 {
36
37 }
38 //===== 
39 // 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)
40 //===== 
41 void ImageContinuousErode3D::bbUserInitializeProcessing()
42 {
43   
44 }
45 //===== 
46 // 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)
47 //===== 
48 void ImageContinuousErode3D::bbUserFinalizeProcessing()
49 {
50
51 }
52 }
53 // EO namespace bbcreaVtk
54
55