]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousErode3D.cxx
3481 Bug ImageContinuousErode3D return empty object clean
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkImageContinuousErode3D.cxx
index ac412460724c5299e3f732806e89afe7342f03d8..9547e4c8dc07bcb085fca6c9b4bfe0dd19680da6 100644 (file)
@@ -1,6 +1,10 @@
 
 #include "bbcreaVtkImageContinuousErode3D.h"
 #include "bbcreaVtkPackage.h"
+
+#include "vtkImageContinuousErode3D.h"
+
+
 namespace bbcreaVtk
 {
 
@@ -9,12 +13,18 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ImageContinuousErode3D,bbtk::AtomicBlackBox);
 
 void ImageContinuousErode3D::Process()
 {
+    if (bbGetInputImage()!=NULL)
+    {
                vtkImageData* result = erodeFilterRecursive(bbGetInputImage(), bbGetInputRepetitions(), bbGetInputX(),bbGetInputY(),bbGetInputZ());
                bbSetOutputOut(result);
+    } else {
+        bbSetOutputOut(NULL);
+    } // if Image
 }
 
 vtkImageData* ImageContinuousErode3D::erodeFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z)
 {
+    printf("EED ImageContinuousErode3D::erodeFilterRecursive 1\n");
                vtkImageContinuousErode3D *erodeFilter = vtkImageContinuousErode3D ::New();
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
@@ -23,29 +33,31 @@ vtkImageData* ImageContinuousErode3D::erodeFilterRecursive(vtkImageData* image,
     erodeFilter->SetInputData(image);
 #endif
     erodeFilter->SetKernelSize(x, y, z);
-               erodeFilter->Modified();                
+               erodeFilter->Modified();
+    printf("EED ImageContinuousErode3D::erodeFilterRecursive 2\n");
                erodeFilter->Update();
-               vtkImageData* resultRec;
+    printf("EED ImageContinuousErode3D::erodeFilterRecursive 3\n");
                if(repetitions == 0)
                {
-                       resultRec = erodeFilter->GetOutput();
-                       return resultRec;
-               }
-               else {
-                       vtkImageData* resultRec = erodeFilterRecursive(erodeFilter->GetOutput(), (repetitions-1), x, y, z);
-               }
+            printf("EED ImageContinuousErode3D::erodeFilterRecursive 4\n");
+                       return erodeFilter->GetOutput();
+               }else{
+                       return erodeFilterRecursive(erodeFilter->GetOutput(), repetitions-1, x, y, z);
+               } // if repetitions
 }
 
 void ImageContinuousErode3D::bbUserSetDefaultValues()
 {
-
+       bbSetInputX(3); 
+       bbSetInputY(3); 
+       bbSetInputY(3); 
+       bbSetInputRepetitions(0); 
 }
 //===== 
 // 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)
 //===== 
 void ImageContinuousErode3D::bbUserInitializeProcessing()
 {
-  
 }
 //===== 
 // 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)