[Insight-users] StopOptimization

Michael Kuhn michakuhn at gmx . ch
Mon, 25 Aug 2003 14:59:07 -0600


Hi,

When I'm trying to call optimizer->StopOptimization in my observer I get 
the following compiler error:

D:\pack\vtkMy\src\Applications\Mixed\itkUtilities\quaternionObserverMultiResolution.cxx(49) 
: error C2662: 'StopOptimization' : cannot convert 'this' pointer from 
'const class itk::QuaternionRigidTransformGradientDescentOptimizer' to 
'class itk::Gra
dientDescentOptimizer &'
        Conversion loses qualifiers
        C:\programs\vs6p\VC98\INCLUDE\xstring(583) : while compiling 
class-template member function 'void __thiscall 
QuaternionObserverMultiResolution<class itk::RegistrationModule<class 
itk::Image<short,3>,class itk::Image<short,3>,class itk::Image
<short,3> > >::Execute(const class itk::Object *,const class 
itk::EventObject &)'
Error executing cl.exe.

In the execute method, I do a dynamic_cast from itk::Object caller to 
itk::QuaternionRigidTransformGradientDescentOptimizer optimizer:

    OptimizerPointer optimizer = dynamic_cast<OptimizerPointer>(caller);

OptimizerPointer is defined as follows in the .h file of my observer:

    typedef itk::QuaternionRigidTransformGradientDescentOptimizer
        OptimizerType;
    typedef const OptimizerType* OptimizerPointer;



Other calls to this optimizer (like optimizer->GetCurrentPosition()) 
work fine (i.e. the program compiles if I comment  the line that 
contains optimizer->StopOptimization() ).

Can anybody tell me, what I'm doing wrong?

Thanks,

Michael