]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx
808f52677d01c75c36ef402ef8aaf8423f79d4e7
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkImageContinuousErode3D.cxx
1
2 #include "bbcreaVtkImageContinuousErode3D.h"
3 #include "bbcreaVtkPackage.h"
4
5 #include "vtkImageContinuousErode3D.h"
6
7
8 namespace bbcreaVtk
9 {
10
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageContinuousErode3D)
12 BBTK_BLACK_BOX_IMPLEMENTATION(ImageContinuousErode3D,bbtk::AtomicBlackBox);
13
14 void ImageContinuousErode3D::Process()
15 {
16     if (bbGetInputImage()!=NULL)
17     {
18                 vtkImageData* result = erodeFilterRecursive(bbGetInputImage(), bbGetInputRepetitions(), bbGetInputX(),bbGetInputY(),bbGetInputZ());
19                 bbSetOutputOut(result);
20     } else {
21         bbSetOutputOut(NULL);
22     } // if Image
23 }
24
25 vtkImageData* ImageContinuousErode3D::erodeFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z)
26 {
27     printf("EED ImageContinuousErode3D::erodeFilterRecursive 1\n");
28                 vtkImageContinuousErode3D *erodeFilter = vtkImageContinuousErode3D ::New();
29 //EED 2017-01-01 Migration VTK7
30 #if VTK_MAJOR_VERSION <= 5
31     erodeFilter->SetInput (image);
32 #else
33     erodeFilter->SetInputData(image);
34 #endif
35     erodeFilter->SetKernelSize(x, y, z);
36                 erodeFilter->Modified();
37     printf("EED ImageContinuousErode3D::erodeFilterRecursive 2\n");
38                 erodeFilter->Update();
39     printf("EED ImageContinuousErode3D::erodeFilterRecursive 3\n");
40                 if(repetitions == 0)
41                 {
42             printf("EED ImageContinuousErode3D::erodeFilterRecursive 4\n");
43                         return erodeFilter->GetOutput();
44                 }else{
45                         erodeFilterRecursive(erodeFilter->GetOutput(), repetitions-1, x, y, z);
46                 } // if repetitions
47 }
48
49 void ImageContinuousErode3D::bbUserSetDefaultValues()
50 {
51         bbSetInputX(3); 
52         bbSetInputY(3); 
53         bbSetInputY(3); 
54         bbSetInputRepetitions(0); 
55 }
56 //===== 
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)
58 //===== 
59 void ImageContinuousErode3D::bbUserInitializeProcessing()
60 {
61 }
62 //===== 
63 // 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)
64 //===== 
65 void ImageContinuousErode3D::bbUserFinalizeProcessing()
66 {
67
68 }
69 }
70 // EO namespace bbcreaVtk
71
72