18 #ifndef __itkKalmanLinearEstimator_h
19 #define __itkKalmanLinearEstimator_h
23 #include "vnl/vnl_vector_fixed.h"
24 #include "vnl/vnl_matrix_fixed.h"
41 template<
class 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;
68 void UpdateWithNewMeasure(
const ValueType & newMeasure,
74 void ClearEstimation(
void)
79 void ClearVariance(
void)
81 m_Variance.set_identity();
92 m_Variance.set_identity();
108 {
return m_Estimator; }
113 {
return m_Variance; }
120 void UpdateVariance(
const VectorType &);
135 template<
class 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<
class 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;