18 #ifndef itkKalmanLinearEstimator_h
19 #define itkKalmanLinearEstimator_h
23 #include "vnl/vnl_vector_fixed.h"
24 #include "vnl/vnl_matrix_fixed.h"
41 template<
typename T,
unsigned int VEstimatorDimension >
47 itkStaticConstMacro(
Dimension,
unsigned int,
52 typedef vnl_vector_fixed< T, VEstimatorDimension >
VectorType;
56 typedef vnl_matrix_fixed< T, VEstimatorDimension, VEstimatorDimension >
MatrixType;
135 template<
typename T,
unsigned int VEstimatorDimension >
141 ValueType measurePrediction = dot_product(newPredictor, m_Estimator);
143 ValueType errorMeasurePrediction = newMeasure - measurePrediction;
145 VectorType Corrector = m_Variance * newPredictor;
147 for (
unsigned int j = 0; j < VEstimatorDimension; j++ )
149 m_Estimator(j) += Corrector(j) * errorMeasurePrediction;
152 UpdateVariance(newPredictor);
155 template<
typename T,
unsigned int VEstimatorDimension >
162 ValueType denominator = 1.0 / ( 1.0 + dot_product(aux, newPredictor) );
164 for (
unsigned int col = 0; col < VEstimatorDimension; col++ )
166 for (
unsigned int row = 0; row < VEstimatorDimension; row++ )
168 m_Variance(col, row) -= aux(col) * aux(row) * denominator;
const VectorType & GetEstimator(void) const
vnl_matrix_fixed< T, VEstimatorDimension, VEstimatorDimension > MatrixType
void ClearEstimation(void)
void UpdateWithNewMeasure(const ValueType &newMeasure, const VectorType &newPredictor)
const MatrixType & GetVariance(void) const
Implement a linear recursive estimator.
vnl_vector_fixed< T, VEstimatorDimension > VectorType
void SetVariance(const MatrixType &m)
void UpdateVariance(const VectorType &)
void SetVariance(const ValueType &var=1.0)
static const unsigned int Dimension