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