-// -------------------------------------------------------------------------
-template< class I, class S >
-class GaussianFunction
- : public itk::FunctionBase< typename I::PixelType, bool >
-{
-public:
- // Type-related and pointers
- typedef GaussianFunction Self;
- typedef itk::FunctionBase< typename I::PixelType, bool > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- // Superclass' types
- typedef cpPlugins::Extensions::Algorithms::IterativeGaussianModelEstimator< S, 3 > TEstimator;
- typedef cpPlugins::Extensions::Algorithms::RGBToYPbPrFunction< S > TYPbPrFunction;
-
-public:
- itkNewMacro( Self );
- itkTypeMacro( GaussianFunction, itkFunctionBase );
-
- itkGetConstMacro( ModelSupport, unsigned long );
- itkSetMacro( ModelSupport, unsigned long );
-
-public:
- virtual bool Evaluate( const typename I::PixelType& rgb ) const
- {
- /* TODO
- if( !this->m_Estimating )
- {
- this->m_Estimator->AddSample( this->m_YPbPrFunction( rgb ) );
- if( this->m_Estimator->GetNumberOfSamples( ) == this->m_ModelSupport )
- {
- this->m_Estimating = true;
- this->m_Estimator->UpdateModel( );
- std::cout << this->m_Estimator->GetMinimumProbability( ) << std::endl;
- std::cout << this->m_Estimator->GetMaximumProbability( ) << std::endl;
-
- } // fi
- return( true );
- }
- else
- {
- S p = this->m_Estimator->Probability( this->m_YPbPrFunction( rgb ) );
- return( p > this->m_Estimator->GetMinimumProbability( ) );
-
- } // fi
- */
- return( true );
- }
-
-protected:
- GaussianFunction( )
- : Superclass( ),
- m_ModelSupport( 10 )
- {
- this->m_Estimator = TEstimator::New( );
- this->m_Estimator->Clear( );
- this->m_Estimating = false;
- }
- virtual ~GaussianFunction( )
- { }
-
-private:
- // Purposely not implemented
- GaussianFunction( const Self& );
- void operator=( const Self& );
-
-protected:
- typename TEstimator::Pointer m_Estimator;
- TYPbPrFunction m_YPbPrFunction;
-
- unsigned long m_ModelSupport;
- mutable bool m_Estimating;
-};
-