]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Algorithms/ImageFunctorFilter.h
...
[cpPlugins.git] / lib / cpExtensions / Algorithms / ImageFunctorFilter.h
1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
4
5 #ifndef __cpExtensions__Algorithms__ImageFunctorFilter__h__
6 #define __cpExtensions__Algorithms__ImageFunctorFilter__h__
7
8 #include <itkFunctionBase.h>
9 #include <itkImageToImageFilter.h>
10
11 namespace cpExtensions
12 {
13   namespace Algorithms
14   {
15     /**
16      */
17     template< class _TInputImage, class _TOutputImage >
18     class ImageFunctorFilter
19       : public itk::ImageToImageFilter< I, O >
20     {
21     public:
22       typedef ImageFunctorFilter              Self;
23       typedef itk::ImageToImageFilter< I, O > Superclass;
24       typedef itk::SmartPointer< Self >       Pointer;
25       typedef itk::SmartPointer< const Self > ConstPointer;
26
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;
32
33       typedef itk::FunctionBase< TInputPixel, TOutputPixel > TFunctor;
34
35     public:
36       itkNewMacro( Self );
37       itkTypeMacro( ImageFunctorFilter, itkImageToImageFilter );
38
39       itkGetObjectMacro( Functor, TFunctor );
40       itkGetConstObjectMacro( Functor, TFunctor );
41       itkSetObjectMacro( Functor, TFunctor );
42
43     protected:
44       ImageFunctorFilter( );
45       virtual ~ImageFunctorFilter( );
46
47       virtual void ThreadedGenerateData( const TRegion& region, itk::ThreadIdType threadId ) override;
48
49     private:
50       // Purposely not implemented.
51       ImageFunctorFilter( const Self& );
52       void operator=( const Self& );
53
54     protected:
55       typename TFunctor::Pointer m_Functor;
56     };
57
58   } // ecapseman
59
60 } // ecapseman
61
62 #ifndef ITK_MANUAL_INSTANTIATION
63 #  include <cpExtensions/Algorithms/ImageFunctorFilter.hxx>
64 #endif // ITK_MANUAL_INSTANTIATION
65
66 #endif // __cpExtensions__Algorithms__ImageFunctorFilter__h__
67
68 // eof - $RCSfile$