[Insight-users] Demons Observer

Lydia Ng lng at insightful.com
Fri Jun 4 12:57:28 EDT 2004


I think you can only dynamic cast raw pointers and not smart pointer. Instead
of:

> 	  RegistrationFilterType::Pointer filter=
> 		  dynamic_cast< RegistrationFilterType>( object );

try:

 	 const RegistrationFilterType * filter=
 		  dynamic_cast< RegistrationFilterType * >( object );

- Lydia

> -----Original Message-----
> From: Josiane Yankam Njiwa--DEA Clarysse--Fin 11/04
> [mailto:njiwa at creatis.insa-lyon.fr]
> Sent: Friday, June 04, 2004 6:58 AM
> To: insight-users at itk.org
> Subject: [Insight-users] Demons Observer
> 
> 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