]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx
2426 creaVtk Feature New Normal New Black Box vtkImageContinuousDilate3D with repetit...
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkImageContinuousDilate3D.cxx
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageContinuousDilate3D.cxx
new file mode 100644 (file)
index 0000000..815f029
--- /dev/null
@@ -0,0 +1,58 @@
+
+#include "bbcreaVtkImageContinuousDilate3D.h"
+#include "bbcreaVtkPackage.h"
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageContinuousDilate3D)
+BBTK_BLACK_BOX_IMPLEMENTATION(ImageContinuousDilate3D,bbtk::AtomicBlackBox);
+
+void ImageContinuousDilate3D::Process()
+{
+               vtkImageData* result = dilateFilterRecursive(bbGetInputImage(), bbGetInputRepetitions(), bbGetInputX(),bbGetInputY(),bbGetInputZ());
+               bbSetOutputOut(result);
+}
+
+vtkImageData* ImageContinuousDilate3D::dilateFilterRecursive(vtkImageData* image, int repetitions, double x, double y, double z)
+{
+               vtkImageContinuousDilate3D *dilateFilter = vtkImageContinuousDilate3D ::New();
+    dilateFilter->SetInput (image);
+    dilateFilter->SetKernelSize(x, y, z);
+               dilateFilter->Modified();               
+               dilateFilter->Update();
+               vtkImageData* resultRec;
+               if(repetitions == 0)
+               {
+                       resultRec = dilateFilter->GetOutput();
+                       return resultRec;
+               }
+               else {
+                       vtkImageData* resultRec = dilateFilterRecursive(dilateFilter->GetOutput(), (repetitions-1), x, y, z);
+               }
+}
+
+void ImageContinuousDilate3D::bbUserSetDefaultValues()
+{
+
+
+}
+
+void ImageContinuousDilate3D::bbUserInitializeProcessing()
+{
+
+
+}
+
+void ImageContinuousDilate3D::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbcreaVtk
+
+