]> Creatis software - bbtk.git/blobdiff - packages/itk/src/bbitkExtractImageFilter.h
*** empty log message ***
[bbtk.git] / packages / itk / src / bbitkExtractImageFilter.h
index e6597613bb233c8998f7cd4d11b64ab993383ba3..a21de34bb210d35816b56607d98e158cb72d5a92 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "bbtkAtomicBlackBox.h"
 #include "itkExtractImageFilter.h"
+#include "bbtkItkBlackBoxMacros.h"
 #include "bbitkImage.h"
 #include "bbitkImageRegion.h"
 
@@ -15,19 +16,22 @@ namespace bbitk
     public bbtk::AtomicBlackBox,
     public itk::ExtractImageFilter<T,T>
   {
-    BBTK_USER_BLACK_BOX_INTERFACE(ExtractImageFilter,bbtk::AtomicBlackBox);
+    BBTK_TEMPLATE_BLACK_BOX_INTERFACE(ExtractImageFilter,
+                                     bbtk::AtomicBlackBox,
+                                     T);
     typedef itk::ExtractImageFilter<T,T> itkParent;
 
-    BBTK_DECLARE_ITK_INPUT(itkParent,In,const T*);
-    BBTK_DECLARE_ITK_PARAM(itkParent,ExtractionRegion,typename T::RegionType);
-    BBTK_DECLARE_ITK_OUTPUT(itkParent,Out,T*);
-    BBTK_PROCESS(itkParent::Update);
-    
-    void bbDelete() { itkParent::UnRegister(); }
+    BBTK_DECLARE_ITK_INPUT(In,const T*);
+    BBTK_DECLARE_ITK_PARAM(ExtractionRegion,typename T::RegionType);
+    BBTK_DECLARE_ITK_OUTPUT(Out,T*);
+
+    BBTK_ITK_PROCESS();
+    BBTK_ITK_DELETE();
   };
 
 
-  BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(ExtractImageFilter);
+  BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(ExtractImageFilter,
+                                     bbtk::AtomicBlackBox);
   BBTK_NAME("ExtractImageFilter<"+bbtk::TypeName<T>()+">");
   BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
   BBTK_DESCRIPTION("Decrease the image size by cropping the image to the selected region bounds (bbification of itk::ExtractImageFilter)");
@@ -42,8 +46,8 @@ namespace bbitk
   class /*BBTK_EXPORT*/ ExtractImageFilterGeneric
     : public bbtk::AtomicBlackBox
   {
-    BBTK_USER_BLACK_BOX_INTERFACE(ExtractImageFilterGeneric,
-                                 bbtk::AtomicBlackBox);
+    BBTK_BLACK_BOX_INTERFACE(ExtractImageFilterGeneric,
+                            bbtk::AtomicBlackBox);
     BBTK_DECLARE_INPUT(In,anyImagePointer);
     BBTK_DECLARE_INPUT(Region,anyImageRegion);
     BBTK_DECLARE_OUTPUT(Out,anyImagePointer);
@@ -59,9 +63,9 @@ namespace bbitk
   BBTK_AUTHOR("laurent.guigues at creatis.insa-lyon.fr");
   BBTK_CATEGORY("image;filter");
   BBTK_DESCRIPTION("Decrease the image size by cropping the image to the selected region bounds (bbification of itk::ExtractImageFilter)");
-  BBTK_INPUT(ExtractImageFilterGeneric,In,"Input image",anyImagePointer);
-  BBTK_INPUT(ExtractImageFilterGeneric,Region,"Extraction region",anyImageRegion);
-  BBTK_OUTPUT(ExtractImageFilterGeneric,Out,"Output image",anyImagePointer);
+  BBTK_INPUT(ExtractImageFilterGeneric,In,"Input image",anyImagePointer,"");
+  BBTK_INPUT(ExtractImageFilterGeneric,Region,"Extraction region",anyImageRegion,"");
+  BBTK_OUTPUT(ExtractImageFilterGeneric,Out,"Output image",anyImagePointer,"");
   BBTK_END_DESCRIBE_BLACK_BOX(ExtractImageFilterGeneric);
   void ExtractImageFilterGeneric::ProcessSwitch()
   {
@@ -76,13 +80,13 @@ namespace bbitk
                        <<bbtk::TypeName<T>()<<">()"<<std::endl);
     typedef T ImageType;
     typedef ExtractImageFilter<ImageType> FilterType;
-    FilterType* f = FilterType::bbNew("Temp");
+    typename FilterType::Pointer f = FilterType::New("Temp");
     f->bbSetInputIn( this->bbGetInputIn().unsafe_get<T*>() );
     f->bbSetInputExtractionRegion ( this->bbGetInputRegion().get<typename T::RegionType>() );
     f->bbExecute();
     f->bbGetOutputOut()->Register();
     this->bbSetOutputOut( f->bbGetOutputOut() );
-    f->bbDelete();
+    //  f->bbDelete();
 
     bbtkDebugDecTab("Core",9);
   }