]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx
#3110 creaVtk Bug New Normal - branch vtk7itk4 compilation with vtk7
[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 //EED 2017-01-01 Migration VTK7
20 #if VTK_MAJOR_VERSION <= 5
21     erodeFilter->SetInput (image);
22 #else
23     erodeFilter->SetInputData(image);
24 #endif
25     erodeFilter->SetKernelSize(x, y, z);
26                 erodeFilter->Modified();                
27                 erodeFilter->Update();
28                 vtkImageData* resultRec;
29                 if(repetitions == 0)
30                 {
31                         resultRec = erodeFilter->GetOutput();
32                         return resultRec;
33                 }
34                 else {
35                         vtkImageData* resultRec = erodeFilterRecursive(erodeFilter->GetOutput(), (repetitions-1), x, y, z);
36                 }
37 }
38
39 void ImageContinuousErode3D::bbUserSetDefaultValues()
40 {
41
42 }
43 //===== 
44 // 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)
45 //===== 
46 void ImageContinuousErode3D::bbUserInitializeProcessing()
47 {
48   
49 }
50 //===== 
51 // 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)
52 //===== 
53 void ImageContinuousErode3D::bbUserFinalizeProcessing()
54 {
55
56 }
57 }
58 // EO namespace bbcreaVtk
59
60