]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx
#3276 creaVtk Feature New Normal - DistanceMap Box
[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                 vtkImageData* result = erodeFilterRecursive(bbGetInputImage(), bbGetInputRepetitions(), bbGetInputX(),bbGetInputY(),bbGetInputZ());
17                 bbSetOutputOut(result);
18 }
19
20 vtkImageData* ImageContinuousErode3D::erodeFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z)
21 {
22                 vtkImageContinuousErode3D *erodeFilter = vtkImageContinuousErode3D ::New();
23 //EED 2017-01-01 Migration VTK7
24 #if VTK_MAJOR_VERSION <= 5
25     erodeFilter->SetInput (image);
26 #else
27     erodeFilter->SetInputData(image);
28 #endif
29     erodeFilter->SetKernelSize(x, y, z);
30                 erodeFilter->Modified();                
31                 erodeFilter->Update();
32                 vtkImageData* resultRec;
33                 if(repetitions == 0)
34                 {
35                         resultRec = erodeFilter->GetOutput();
36                         return resultRec;
37                 }else{
38                         erodeFilterRecursive(erodeFilter->GetOutput(), (repetitions-1), x, y, z);
39                 } // if repetitions
40 }
41
42 void ImageContinuousErode3D::bbUserSetDefaultValues()
43 {
44         bbSetInputX(3); 
45         bbSetInputY(3); 
46         bbSetInputY(3); 
47         bbSetInputRepetitions(0); 
48 }
49 //===== 
50 // 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)
51 //===== 
52 void ImageContinuousErode3D::bbUserInitializeProcessing()
53 {
54 }
55 //===== 
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)
57 //===== 
58 void ImageContinuousErode3D::bbUserFinalizeProcessing()
59 {
60
61 }
62 }
63 // EO namespace bbcreaVtk
64
65