// ------------------------------------------------------------------------- // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ------------------------------------------------------------------------- #ifndef __CPPLUGINS__EXTENSIONS__ALGORITHMS__ITERATIVEGAUSSIANMODELESTIMATOR__H__ #define __CPPLUGINS__EXTENSIONS__ALGORITHMS__ITERATIVEGAUSSIANMODELESTIMATOR__H__ #include #include #include #include namespace cpPlugins { namespace Extensions { namespace Algorithms { /** */ template< class S, unsigned int D > class IterativeGaussianModelEstimator : public itk::Object { public: typedef IterativeGaussianModelEstimator Self; typedef itk::Object Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef S TScalar; itkStaticConstMacro( Dimension, unsigned int, D ); // Begin concept checking #ifdef ITK_USE_CONCEPT_CHECKING itkConceptMacro( ScalarTypeHasFloatResolution, ( itk::Concept::IsFloatingPoint< S > ) ); #endif // End concept checking typedef vnl_matrix< S > TMatrix; typedef std::vector< TMatrix > TMatrices; public: itkNewMacro( Self ); itkTypeMacro( IterativeGaussianModelEstimator, itkObject ); itkGetConstMacro( MinimumProbability, S ); itkGetConstMacro( MaximumProbability, S ); public: unsigned long GetNumberOfSamples( ) const { return( this->m_Samples.size( ) ); } void UpdateModel( ); template< class V > S Probability( const V& sample ) const; S Probability( const S& s_x, const S& s_y, ... ) const; template< class V, class M > void GetModel( V& m, M& E ) const; void Clear( ); template< class V > void AddSample( const V& sample ); void AddSample( const S& s_x, const S& s_y, ... ); protected: IterativeGaussianModelEstimator( ); virtual ~IterativeGaussianModelEstimator( ); private: // Purposely not implemented IterativeGaussianModelEstimator( const Self& other ); void operator=( const Self& other ); protected: TMatrix m_S1; TMatrix m_S2; TMatrices m_Samples; bool m_Updated; TMatrix m_Cov; TMatrix m_Mean; TMatrix m_InvCov; S m_DensityCoeff; S m_MinimumProbability; S m_MaximumProbability; }; } // ecapseman } // ecapseman } // ecapseman #include #endif // __CPPLUGINS__EXTENSIONS__ALGORITHMS__ITERATIVEGAUSSIANMODELESTIMATOR__H__ // eof - $RCSfile$