]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Functors/GaussianModelEstimatorFunction.h
...
[FrontAlgorithms.git] / lib / fpa / Image / Functors / GaussianModelEstimatorFunction.h
1 #ifndef __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__H__
2 #define __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__H__
3
4 #include <cpPlugins/Extensions/Algorithms/IterativeGaussianModelEstimator.h>
5 #include <cpPlugins/Extensions/Algorithms/RGBToYPbPrFunction.h>
6 #include <itkFunctionBase.h>
7
8 namespace fpa
9 {
10   namespace Image
11   {
12     namespace Functors
13     {
14       /**
15        */
16       template< class I, class S >
17       class GaussianModelEstimatorFunction
18         : public itk::FunctionBase< typename I::PixelType, bool >
19       {
20       public:
21         // Type-related and pointers
22         typedef GaussianModelEstimatorFunction                   Self;
23         typedef itk::FunctionBase< typename I::PixelType, bool > Superclass;
24         typedef itk::SmartPointer< Self >                        Pointer;
25         typedef itk::SmartPointer< const Self >                  ConstPointer;
26
27         // Superclass' types
28         typedef cpPlugins::Extensions::Algorithms::IterativeGaussianModelEstimator< S, 3 > TEstimator;
29         typedef cpPlugins::Extensions::Algorithms::RGBToYPbPrFunction< S > TYPbPrFunction;
30
31       public:
32         itkNewMacro( Self );
33         itkTypeMacro( GaussianModelEstimatorFunction, itkFunctionBase );
34
35         itkGetConstMacro( ModelSupport, unsigned long );
36
37       public:
38         bool SaveModelToFile( const std::string& filename ) const;
39         bool LoadModelFromFile( const std::string& filename );
40
41         virtual void SetModelSupport( const unsigned long& s );
42         virtual bool Evaluate( const typename I::PixelType& rgb ) const;
43
44       protected:
45         GaussianModelEstimatorFunction( );
46         virtual ~GaussianModelEstimatorFunction( );
47
48       private:
49         // Purposely not implemented
50         GaussianModelEstimatorFunction( const Self& );
51         void operator=( const Self& );
52
53       protected:
54         typename TEstimator::Pointer m_Estimator;
55         TYPbPrFunction m_YPbPrFunction;
56
57         unsigned long m_ModelSupport;
58         unsigned long m_RealModelSupport;
59         mutable bool m_Estimating;
60       };
61
62     } // ecapseman
63
64   } // ecapseman
65
66 } // ecapseman
67
68 #ifndef ITK_MANUAL_INSTANTIATION
69 #include <fpa/Image/Functors/GaussianModelEstimatorFunction.hxx>
70 #endif // ITK_MANUAL_INSTANTIATION
71
72 #endif // __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__H__
73
74 // eof - $RCSfile$