[Insight-users] WG: BUG: itkVersorRigid3DTransformOptimizer
Luis Ibanez
luis.ibanez at kitware.com
Sun Nov 22 16:30:34 EST 2009
Hi Gerald,
The invocation of IterationEvent() from the itkVersorRigid3DTransformOptimizer
seems to be working fine.
See here, for example, its use in the test ImageRegistration8Test
http://www.cdash.org/CDash/testDetails.php?test=30890058&build=477408
This output was printed out from the Command/Observer that listens
to the IterationEvents of this optimizer.
This test is defined in
Insight/Examples/Registration/ImageRegistration8.cxx
Are you calling the method StartRegistration() ( or the method Update() )
in the registration method ?
Please let us know,
Thanks
Luis
----------------------------------------------------------------------------------------------------
On Wed, Nov 18, 2009 at 5:38 AM, Lodron, Gerald
<Gerald.Lodron at joanneum.at> wrote:
>
> Sorry, for sure i mean the itk::IterationEvent and not the update function.
>
>
>
>
> Hello,
>
> I tested the itkVersorRigid3DTransformOptimizer. It does not call the iteration update. Here my code:
>
> itk::Optimizer::Pointer optimizer;
>
> typedef itk::VersorRigid3DTransformOptimizer VROptimizer;
>
> optimizer = VROptimizer::New();
> dynamic_cast<VROptimizer*>(optimizer.GetPointer())->SetNumberOfIterations(200);
>
> CommandIterationUpdate<VROptimizer>::Pointer observer = CommandIterationUpdate<VROptimizer>::New();
> optimizer->AddObserver( itk::IterationEvent(), observer );
>
>
>
> template<class OptimizerType>
> class CommandIterationUpdate : public itk::Command
> {
> public:
> typedef CommandIterationUpdate Self;
> typedef itk::Command Superclass;
> typedef itk::SmartPointer<CommandIterationUpdate> Pointer;
> itkNewMacro( CommandIterationUpdate );
> protected:
> CommandIterationUpdate() {};
>
> typedef const OptimizerType * OptimizerPointer;
>
> public:
>
> void Execute(itk::Object *caller, const itk::EventObject & event)
> {
> Execute( (const itk::Object *)caller, event);
> }
>
> void Execute(const itk::Object * object, const itk::EventObject & event)
> {
> OptimizerPointer optimizer = dynamic_cast< OptimizerPointer >( object );
> if( ! itk::IterationEvent().CheckEvent( &event ) )
> {
> return;
> }
> std::cout << "Iteration " << optimizer->GetCurrentIteration() << " \t";
> std::cout << "Value "<< optimizer->GetValue() << " \t";
> std::cout << "Position " << optimizer->GetCurrentPosition() << std::endl;
> }
> };
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list