[Insight-users] Observer: GetValue and GetCurrentTransform

Luis Ibanez luis . ibanez at kitware . com
Wed, 20 Aug 2003 16:47:22 -0400


Hi Michael,

You observation is correct,
and this behavior is normal and intended.

What happens is that the optimizer *uses* the
transform for performing its internal computations.

The transform class is not intended to be a vehicle
for transporting information in/out of the registration
method.

The information about the current transform passes
through the following methods

     registration->SetInitialTransformParameters();

at the begining of the registration process,
and

     registration->GetLastTransformParameters();

at the end of the registration process.


---

The reason by the transform has different values
is that it is used for computing the derivatives
of the metric.

If you want to do something like reporting values
while the registration is running, then you must
use the values returned by the optimizer, not
the ones taken from the transform, because the
optimizer may have used the transform for computing
some other values of the metric.

The same goes for the metric. You should use the
values returned by the optimizer object, not the values
returned by the metric. This is also because the optimizer
*uses* the metric for performing its internal computations.
So the metric state does not necessarily reflect the
current state of the optimizer.


  Regards,


    Luis


---------------------
Michael Kuhn wrote:
> Hi,
> 
> I've just noticed, that the outputs of optimizer->GetValue() and 
> optimizer->GetCurrentPosition() in my observer do not correspond to each 
> other. This means, if I take the output of GetCurrentPosition() and set 
> it as the transform of a metric, the computed value is not the one that 
> optimizer->GetValue() returns. Instead, the optimizer->GetValue() 
> corresponds to the optimizer->GetCurrentPosition() of the previous 
> iteration:
> 
> ------------------ current iteration: 0
> metric value: 8.1009e+007
> angle[rad]: 0.0458399
> axis: [0.166463, 0.0384068, 0.985299]
> translation: [0.140782, -0.097263, 0.027042]
> ------------------ current iteration: 1
> metric value: 3.77236e+007
> angle[rad]: 0.0190741
> axis: [0.817551, 0.105812, -0.566051]
> translation: [0.274351, -0.200454, 0.0532276]
> ------------------ current iteration: 2
> metric value: 3.77236e+007
> angle[rad]: 0.0190741
> axis: [0.817551, 0.105812, -0.566051]
> translation: [0.274351, -0.200454, 0.0532276]
> 
> In the example above the metric value in iteration "1" corresponds to 
> the transform in iteration "0". Is this intended?
> 
> Thanks,
> 
> Michael
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>