]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Algorithms/MultiScaleGaussianImageFilter.h
...
[cpPlugins.git] / lib / cpExtensions / Algorithms / MultiScaleGaussianImageFilter.h
1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
4
5 #ifndef __CPEXTENSIONS__ALGORITHMS__MULTISCALEGAUSSIANIMAGEFILTER__H__
6 #define __CPEXTENSIONS__ALGORITHMS__MULTISCALEGAUSSIANIMAGEFILTER__H__
7
8 #include <set>
9 #include <itkImageToImageFilter.h>
10
11 namespace cpExtensions
12   {
13     namespace Algorithms
14     {
15       /**
16        */
17       template< class I, class O >
18       class MultiScaleGaussianImageFilter
19         : public itk::ImageToImageFilter< I, O >
20       {
21       public:
22         typedef MultiScaleGaussianImageFilter   Self;
23         typedef itk::ImageToImageFilter< I, O > Superclass;
24         typedef itk::SmartPointer< Self >       Pointer;
25         typedef itk::SmartPointer< const Self > ConstPointer;
26
27         typedef I TInputImage;
28         typedef O TOutputImage;
29
30         typedef std::set< double > TScalesContainer;
31
32         enum FilterId
33         {
34           Gradient = 0,
35           GradientMagnitude,
36           Hessian,
37           None
38         };
39
40       protected:
41         /**
42          */
43         class _Greater
44         {
45         public:
46           typedef typename O::PixelType _T;
47
48         public:
49           _Greater( );
50           virtual ~_Greater( );
51           bool operator!=( const _Greater& b ) const;
52           bool operator==( const _Greater& b ) const;
53           inline _T operator()( const _T& a ) const;
54           inline _T operator()( const _T& a, const _T& b ) const;
55         };
56
57       public:
58         itkNewMacro( Self );
59         itkTypeMacro( MultiScaleGaussianImageFilter, itkImageToImageFilter );
60
61       public:
62         void SetFilterToGradient( );
63         void SetFilterToGradientMagnitude( );
64         void SetFilterToHessian( );
65
66         bool IsGradientFilter( ) const;
67         bool IsGradientMagnitudeFilter( ) const;
68         bool IsHessianFilter( ) const;
69
70         void AddScale( const double& s );
71         unsigned long GetNumberOfScales( ) const;
72
73       protected:
74         MultiScaleGaussianImageFilter( );
75         virtual ~MultiScaleGaussianImageFilter( );
76
77         virtual void GenerateData( );
78
79         template< class F >
80         void _GenerateData( );
81
82       private:
83         // Purposely not implemented.
84         MultiScaleGaussianImageFilter( const Self& );
85         void operator=( const Self& );
86
87       protected:
88         TScalesContainer m_Scales;
89         FilterId m_FilterId;
90       };
91
92   } // ecapseman
93
94 } // ecapseman
95
96 #include <cpExtensions/Algorithms/MultiScaleGaussianImageFilter.hxx>
97
98 #endif // __CPEXTENSIONS__ALGORITHMS__MULTISCALEGAUSSIANIMAGEFILTER__H__
99
100 // eof - $RCSfile$