00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifdef _USE_ITK_
00033
00034 #include "bbtkAtomicBlackBox.h"
00035 #include "itkExtractImageFilter.h"
00036 #include "bbtkItkBlackBoxMacros.h"
00037 #include "bbitkImage.h"
00038 #include "bbitkImageRegion.h"
00039
00040 namespace bbitk
00041 {
00042
00043
00044 template <class T>
00045 class ExtractImageFilter
00046 :
00047 public bbtk::AtomicBlackBox,
00048 public itk::ExtractImageFilter<T,T>
00049 {
00050 BBTK_TEMPLATE_BLACK_BOX_INTERFACE(ExtractImageFilter,
00051 bbtk::AtomicBlackBox,
00052 T);
00053 typedef itk::ExtractImageFilter<T,T> itkParent;
00054
00055 BBTK_DECLARE_ITK_INPUT(In,const T*);
00056 BBTK_DECLARE_ITK_PARAM(ExtractionRegion,typename T::RegionType);
00057 BBTK_DECLARE_ITK_OUTPUT(Out,T*);
00058
00059 BBTK_ITK_PROCESS();
00060 BBTK_ITK_DELETE();
00061 };
00062
00063
00064 BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(ExtractImageFilter,
00065 bbtk::AtomicBlackBox);
00066 BBTK_NAME("ExtractImageFilter<"+bbtk::TypeName<T>()+">");
00067 BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
00068 BBTK_DESCRIPTION("Decrease the image size by cropping the image to the selected region bounds (bbification of itk::ExtractImageFilter)");
00069 BBTK_TEMPLATE_INPUT(ExtractImageFilter,In,"Input image",const T*);
00070 BBTK_TEMPLATE_INPUT(ExtractImageFilter,ExtractionRegion,"Extraction region",typename T::RegionType);
00071 BBTK_TEMPLATE_OUTPUT(ExtractImageFilter,Out,"Output image",T*);
00072 BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(ExtractImageFilter);
00073
00074
00075
00076
00077 class ExtractImageFilterGeneric
00078 : public bbtk::AtomicBlackBox
00079 {
00080 BBTK_BLACK_BOX_INTERFACE(ExtractImageFilterGeneric,
00081 bbtk::AtomicBlackBox);
00082 BBTK_DECLARE_INPUT(In,anyImagePointer);
00083 BBTK_DECLARE_INPUT(Region,anyImageRegion);
00084 BBTK_DECLARE_OUTPUT(Out,anyImagePointer);
00085 BBTK_PROCESS(ProcessSwitch);
00086 private :
00087 inline void ProcessSwitch();
00088 template <class T> void Process();
00089 };
00090
00091 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ExtractImageFilterGeneric,
00092 bbtk::AtomicBlackBox);
00093 BBTK_NAME("ExtractImageFilter");
00094 BBTK_AUTHOR("laurent.guigues at creatis.insa-lyon.fr");
00095 BBTK_CATEGORY("image;filter");
00096 BBTK_DESCRIPTION("Decrease the image size by cropping the image to the selected region bounds (bbification of itk::ExtractImageFilter)");
00097 BBTK_INPUT(ExtractImageFilterGeneric,In,"Input image",anyImagePointer,"");
00098 BBTK_INPUT(ExtractImageFilterGeneric,Region,"Extraction region",anyImageRegion,"");
00099 BBTK_OUTPUT(ExtractImageFilterGeneric,Out,"Output image",anyImagePointer,"");
00100 BBTK_END_DESCRIBE_BLACK_BOX(ExtractImageFilterGeneric);
00101 void ExtractImageFilterGeneric::ProcessSwitch()
00102 {
00103 BBTK_TEMPLATE_ITK_IMAGE_SWITCH(bbGetInputIn().type(), this->Process);
00104 }
00105
00106 template <class T>
00107 void ExtractImageFilterGeneric::Process()
00108 {
00109 bbtkDebugMessageInc("Core",9,
00110 "bbitk::ExtractImageFilterGeneric::Process<"
00111 <<bbtk::TypeName<T>()<<">()"<<std::endl);
00112 typedef T ImageType;
00113 typedef ExtractImageFilter<ImageType> FilterType;
00114 typename FilterType::Pointer f = FilterType::New("Temp");
00115 f->bbSetInputIn( this->bbGetInputIn().unsafe_get<T*>() );
00116 f->bbSetInputExtractionRegion ( this->bbGetInputRegion().get<typename T::RegionType>() );
00117 f->bbExecute();
00118 f->bbGetOutputOut()->Register();
00119 this->bbSetOutputOut( f->bbGetOutputOut() );
00120
00121
00122 bbtkDebugDecTab("Core",9);
00123 }
00124
00125 }
00126
00127
00128 #endif