[Insight-users] Help for mapping DeformableRegistration2.cxx to Python

Yang Wang dietpaopao@netscape.net
Wed May 5 20:05:44 EDT 2004


Hi, all

I am trying to map the DeformableRegistration2.cxx into Python.
However, don't know how to do the following two parts:
(1)   
  typedef itk::Vector< float, Dimension >    VectorPixelType;
  typedef itk::Image<  VectorPixelType, Dimension > DeformationFieldType;
  typedef itk::DemonsRegistrationFilter<
                                InternalImageType,
                                InternalImageType,
                                DeformationFieldType>   
RegistrationFilterType;
  RegistrationFilterType::Pointer filter = RegistrationFilterType::New();

(2)
class CommandIterationUpdate : public itk::Command
  {
  public:
    typedef  CommandIterationUpdate   Self;
    typedef  itk::Command             Superclass;
    typedef  itk::SmartPointer<CommandIterationUpdate>  Pointer;
    itkNewMacro( CommandIterationUpdate );
  protected:
    CommandIterationUpdate() {};

    typedef itk::Image< float, 2 > InternalImageType;
    typedef itk::Vector< float, 2 >    VectorPixelType;
    typedef itk::Image<  VectorPixelType, 2 > DeformationFieldType;

    typedef itk::DemonsRegistrationFilter<
                                InternalImageType,
                                InternalImageType,
                                DeformationFieldType>   
RegistrationFilterType;

  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)
      {
         const RegistrationFilterType * filter =
          dynamic_cast< const RegistrationFilterType * >( object );
        if( typeid( event ) != typeid( itk::IterationEvent ) )
          {
          return;
          }
        std::cout << filter->GetMetric() << std::endl;
      }
  };


CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New();
  filter->AddObserver( itk::IterationEvent(), observer );

**************************************

Thanks in advance for any hint or help!!


Yours,
Casper




More information about the Insight-users mailing list