[Insight-users] Statistics: Find out coefficient of affine
transform: Speed up convergence
Mathieu Malaterre
mathieu.malaterre at gmail.com
Mon May 7 05:32:38 EDT 2007
Hi Luis,
Thanks a lot for this info, I was not aware of this filter. Anyway I
have now a problem of speed of convergence. Technically I only have
very few samples (6 to 8). so for now I am reinjecting each sample
multiple times (arbitrary number of time: 100) to get a better
estimate.
My question is then, is there something smarter to make the
algorithm converge faster ?
Thanks,
-Mathieu
dummy code example for Y = 5 + 3*X:
typedef itk::KalmanLinearEstimator<double,2> KalmanFilterType;
KalmanFilterType filter;
filter.ClearEstimation();
filter.SetVariance(1.0);
ValueType measure;
VectorType predictor;
VectorType planeEquation;
planeEquation(0) = 5.0;
planeEquation(1) = 3.0;
const unsigned int N = 6; // number of sample
predictor(0) = 1.0;
for(unsigned int duplicate = 0; duplicate < 100; ++duplicate) //
better estimate
for(unsigned int ax=0; ax < N; ax++)
{
predictor(1) = ax;
measure = planeEquation(0)*predictor(0) + planeEquation(1)*predictor(1);
filter.UpdateWithNewMeasure(measure,predictor);
}
On 5/6/07, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
> Hi Mathieu,
>
> You may want to try the KalmanLinearEstimator.
>
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1KalmanLinearEstimator.html
>
>
> Your estimator will be the vector [a,b],
>
> and your measures will be the vector [1,Y]
>
>
> The Kalman Linear Estimator should converge to the vector [a,b] that
> minimizes the sum of squared errors between X and (a+bY).
>
> For an example, you may want to look at:
>
>
>
> Insight/Testing/Code/Algorithms/
> itkKalmanLinearEstimatorTest.cxx
>
>
>
> Regards,
>
>
> Luis
>
>
> ---------------------------
> Mathieu Malaterre wrote:
> > Hello,
> >
> > I have a pretty simple problem to solve and I was wondering if I
> > could reuse any brick already existing in ITK.
> >
> > I am working with a 4D dataset (x,y,y and theta), where I can
> > express for each pixel that:
> >
> > I(x,y,z)/sin(theta) = F(x,y,z) + b*I(x,y,z)/tan(theta)
> >
> > My goal here is to find out the b constant, I do not need the
> > F(x,y,z) part. Obvisouly all I need to do is draw the line
> >
> > X = a + b Y
> >
> > where X = I(x,y,z)/sin(theta) and Y = I(x,y,z)/tan(theta) and the
> > slope will give me 'b'.
> >
> > Any suggestions on which class to reuse ?
> > thanks !
>
--
Mathieu
Tel: +33 6 32 13 33 40
More information about the Insight-users
mailing list