[Insight-users] ReceptorMemberCommand

Luis Ibanez luis.ibanez at kitware.com
Sat Sep 9 15:58:30 EDT 2006


Hi Rupert

The Amoeba optimizer in ITK is a wrapper around the vnl
amoeba optimizer. Since VNL does not send any events during
the iterations of its optimizers, ITK implemented a trick in
the following way:

    itkAmoebaOptimizer  wraps vnl_amoeba

   SingleValuedVnlCostFunctionAdaptor
                        wraps vnl_cost_function


vnl_amoeba calls the f() method of the vnl_cost_function,
that in turn calls the GetValue() method of the ITK
SingleValuedVnlCostFunctionAdaptor.

The SingleValuedVnlCostFunctionAdaptor sends events that
are "observed" by the itkAmoebaOptimizer and resent as
iteration events.

In this way, we get events *per evaluation* of the cost
function. Note that this is not completely equivalent
to events per iteration of the amoeba_optimizer,.... but
it is better than nothing.

as a rule of thumb you could expect that N evaluations of
the cost_function are equivalent to one iteration of the
amoeba optimizer, where N is the dimensionality of the
parametric space of the cost function.


For more details, please look at the method:

IterationReport()

in itkSingleValuedNonLiinearVnlOptimizer.cxx, lines 109-116.


Note that the receptor command is connected to the cost
function adaptor in line 70 of the same file.


If you connect a normal Command (observer) to the amoeba
optimizer, you should receive those IterationEvents, that
correspond to one evaluation of the cost function.



   Regards,


      Luis


---------------------
Rupert Brooks wrote:
> Hi,
> 
>> From looking in the code, it seems that for VNL optimizers such as the
> 
> Amoeba, it is possible to get per-iteration callbacks using the
> ReceptorMemberCommand<type>.  I would be interested in doing this, but
> im having trouble figuring out how it works - my naive approach was to
> inherit my per-iteration command from ReceptorMemberCommand instead of
> itk::Command, but this doesn't manage it, at least not with Amoeba.
> 
> Are there any examples someone could point me to of getting per
> iteration information from a VNL optimizer?
> 
> Thanks,
> Rupert B.
> 




More information about the Insight-users mailing list