[Insight-users] Demons observer

Luis Ibanez luis.ibanez at kitware.com
Tue Jun 8 11:29:19 EDT 2004


Hi Josiane,


As Lydia replied to you on June 4th:
http://www.itk.org/pipermail/insight-users/2004-June/008789.html

You must modify the line

 >    dynamic_cast< RegistrationFilterType>( object );

and put

 >    dynamic_cast< RegistrationFilterType * >( object );


Dynamic casting requires pointers or references to types.
It cannot be done on direct types.


    Regards,


       Luis


------------------------------------------------------
Josiane Yankam Njiwa--DEA Clarysse--Fin 11/04 wrote:

> 
> Hi,
> 
> I want to see how the demons registration compute the displacement at each
> iteration and i like to add to the program an obsever, but i have this
> message error during the compilation:error C2680: 'class
> itk::DemonsRegistrationFilter<class itk::Image<float,2>,class
> itk::Image<float,2>,class itk::Image<class itk::Vector<float,2>,2> >' :
> invalid target type for dynamic_cast
> Error executing cl.exe.
> 
> I don't how to overpass my problem. Thanks for your help.
> 
> Regards
> 
> Josiane
> 
> 
> Here is my code:
> 
> 
> 
> #include "itkCommand.h"
> class CommandIterationUpdate : public itk::Command
> {
> public:
>   typedef  CommandIterationUpdate   Self;
>   typedef  itk::Command             Superclass;
>   typedef itk::SmartPointer<Self>  Pointer;
>   itkNewMacro( Self );
> protected:
>   CommandIterationUpdate() {};
> public:
> 
>   typedef float InternalPixelType;
>   typedef itk::Image< InternalPixelType, 2 > InternalImageType;
>   typedef itk::Vector< float, 2 >    VectorPixelType;
>   typedef itk::Image<  VectorPixelType, 2 > DeformationFieldType;
>   typedef itk::DemonsRegistrationFilter<
>                                 InternalImageType,
>                                 InternalImageType,
>                                 DeformationFieldType>
> RegistrationFilterType;
> 
> 
> 
>   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)
>     {
> 
>           RegistrationFilterType::Pointer filter=
>                   dynamic_cast< RegistrationFilterType>( object );
> 
>       if( typeid( event ) != typeid( itk::IterationEvent ) )
>         {
>         return;
>         }
>       std::cout << filter->GetElapsedIterations()<< "   ";
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 





More information about the Insight-users mailing list