1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __cpExtensions__Algorithms__ImageFunctorFilter__h__
6 #define __cpExtensions__Algorithms__ImageFunctorFilter__h__
8 #include <itkFunctionBase.h>
9 #include <itkImageToImageFilter.h>
11 namespace cpExtensions
17 template< class _TInputImage, class _TOutputImage >
18 class ImageFunctorFilter
19 : public itk::ImageToImageFilter< I, O >
22 typedef ImageFunctorFilter Self;
23 typedef itk::ImageToImageFilter< I, O > Superclass;
24 typedef itk::SmartPointer< Self > Pointer;
25 typedef itk::SmartPointer< const Self > ConstPointer;
27 typedef _TInputImage TInputImage;
28 typedef _TOutputImage TOutputImage;
29 typedef typename TInputImage::PixelType TInputPixel;
30 typedef typename TOutputImage::PixelType TOutputPixel;
31 typedef typename TOutputImage::RegionType TRegion;
33 typedef itk::FunctionBase< TInputPixel, TOutputPixel > TFunctor;
37 itkTypeMacro( ImageFunctorFilter, itkImageToImageFilter );
39 itkGetObjectMacro( Functor, TFunctor );
40 itkGetConstObjectMacro( Functor, TFunctor );
41 itkSetObjectMacro( Functor, TFunctor );
44 ImageFunctorFilter( );
45 virtual ~ImageFunctorFilter( );
47 virtual void ThreadedGenerateData( const TRegion& region, itk::ThreadIdType threadId ) override;
50 // Purposely not implemented.
51 ImageFunctorFilter( const Self& );
52 void operator=( const Self& );
55 typename TFunctor::Pointer m_Functor;
62 #ifndef ITK_MANUAL_INSTANTIATION
63 # include <cpExtensions/Algorithms/ImageFunctorFilter.hxx>
64 #endif // ITK_MANUAL_INSTANTIATION
66 #endif // __cpExtensions__Algorithms__ImageFunctorFilter__h__