]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Algorithms/ImageFunctionFilter.h
...
[cpPlugins.git] / lib / cpExtensions / Algorithms / ImageFunctionFilter.h
1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
4
5 #ifndef __CPEXTENSIONS__ALGORITHMS__IMAGEFUNCTIONFILTER__H__
6 #define __CPEXTENSIONS__ALGORITHMS__IMAGEFUNCTIONFILTER__H__
7
8 #include <itkImageToImageFilter.h>
9
10 namespace cpExtensions
11 {
12   namespace Algorithms
13   {
14     /**
15      */
16     template< class _TInput, class _TOutput, class _TFunction >
17     class ImageFunctionFilter
18       : public itk::ImageToImageFilter< _TInput, _TOutput >
19     {
20     public:
21       typedef ImageFunctionFilter                          Self;
22       typedef itk::ImageToImageFilter< _TInput, _TOutput > Superclass;
23       typedef itk::SmartPointer< Self >                    Pointer;
24       typedef itk::SmartPointer< const Self >              ConstPointer;
25
26       typedef _TInput    TInput;
27       typedef _TOutput   TOutput;
28       typedef _TFunction TFunction;
29
30       typedef typename TOutput::RegionType TRegion;
31
32     public:
33       itkNewMacro( Self );
34       itkTypeMacro( ImageFunctionFilter, itkImageToImageFilter );
35
36       itkGetObjectMacro( Function, TFunction );
37       itkSetObjectMacro( Function, TFunction );
38
39     protected:
40       ImageFunctionFilter( );
41       virtual ~ImageFunctionFilter( );
42
43       virtual void BeforeThreadedGenerateData( ) ITK_OVERRIDE;
44       virtual void ThreadedGenerateData(
45         const TRegion& region,
46         itk::ThreadIdType threadId
47         ) ITK_OVERRIDE;
48
49     private:
50       // Purposely not implemented.
51       ImageFunctionFilter( const Self& );
52       void operator=( const Self& );
53
54     protected:
55       typename TFunction::Pointer m_Function;
56     };
57
58   } // ecapseman
59
60 } // ecapseman
61
62 #ifndef ITK_MANUAL_INSTANTIATION
63 #include <cpExtensions/Algorithms/ImageFunctionFilter.hxx>
64 #endif // ITK_MANUAL_INSTANTIATION
65
66 #endif // __CPEXTENSIONS__ALGORITHMS__IMAGEFUNCTIONFILTER__H__
67
68 // eof - $RCSfile$