]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx
5ed81c769bba5d88a86835d5f54ffada7a8c751d
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkImageContinuousDilate3D.cxx
1
2 #include "bbcreaVtkImageContinuousDilate3D.h"
3 #include "bbcreaVtkPackage.h"
4 namespace bbcreaVtk
5 {
6
7 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageContinuousDilate3D)
8 BBTK_BLACK_BOX_IMPLEMENTATION(ImageContinuousDilate3D,bbtk::AtomicBlackBox);
9
10 void ImageContinuousDilate3D::Process()
11 {
12                 vtkImageData* result = dilateFilterRecursive(bbGetInputImage(), bbGetInputRepetitions(), bbGetInputX(),bbGetInputY(),bbGetInputZ());
13                 bbSetOutputOut(result);
14 }
15
16 vtkImageData* ImageContinuousDilate3D::dilateFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z)
17 {
18                 vtkImageContinuousDilate3D *dilateFilter = vtkImageContinuousDilate3D ::New();
19 //EED 2017-01-01 Migration VTK7
20 #if VTK_MAJOR_VERSION <= 5
21     dilateFilter->SetInput (image);
22 #else
23     dilateFilter->SetInputData(image);
24 #endif
25     dilateFilter->SetKernelSize(x, y, z);
26                 dilateFilter->Modified();               
27                 dilateFilter->Update();
28                 vtkImageData* resultRec;
29                 if(repetitions == 0)
30                 {
31                         resultRec = dilateFilter->GetOutput();
32                         return resultRec;
33                 }
34                 else {
35                         vtkImageData* resultRec = dilateFilterRecursive(dilateFilter->GetOutput(), (repetitions-1), x, y, z);
36                 }
37 }
38
39 void ImageContinuousDilate3D::bbUserSetDefaultValues()
40 {
41
42
43 }
44
45 void ImageContinuousDilate3D::bbUserInitializeProcessing()
46 {
47
48
49 }
50
51 void ImageContinuousDilate3D::bbUserFinalizeProcessing()
52 {
53
54 //  THE FINALIZATION METHOD BODY :
55 //    Here does nothing 
56 //    but this is where you should desallocate the internal/output pointers 
57 //    if any
58   
59 }
60 }
61 // EO namespace bbcreaVtk
62
63