[Insight-users] Re: WrapITK and KappaStatisticImageToImageMetric

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Mar 22 11:16:41 EST 2007


Hi,

Can you provide the wrapper for that class, so I can try to reproduce  
the problem ?

Thanks,

Gaëtan



Le 22 mars 07 à 16:45, Brian Chapman a écrit :

> I am trying to use the KappaStatisticImageToImageMetric to drive an  
> image
> registration problem based on aligning two binary masks. I am  
> currently
> using the Python wrappers from WrapITK. I define a registration  
> technique
> and the metric as follows:
>
> In [2]: import itk
>
> In [3]: imageMetric =  
> itk.KappaStatisticImageToImageMetric.IUC2IUC2.New()
>
> In [4]: registration = itk.ImageRegistrationMethod.IUC2IUC2.New()
>
> When I go to assign the metric to the registration, I get a type  
> error:
>
> In [5]: registration.SetMetric(imageMetric.GetPointer())
> ---------------------------------------------------------------------- 
> -----
> <type 'exceptions.TypeError'>             Traceback (most recent  
> call last)
>
> /Users/brian/Code/Python/Liver/<ipython console> in <module>()
>
> /usr/local/lib/InsightToolkit/WrapITK/lib/ 
> itkImageRegistrationMethod.py in
> SetMetric(*args)
>     506     def SetInitialTransformParameters(*args): return
> _itkImageRegistrationMethod.itkImageRegistrationMethodIUC2IUC2_Pointer 
> _SetIn
> itialTransformParameters(*args)
>     507     def SetInterpolator(*args): return
> _itkImageRegistrationMethod.itkImageRegistrationMethodIUC2IUC2_Pointer 
> _SetIn
> terpolator(*args)
> --> 508     def SetMetric(*args): return
> _itkImageRegistrationMethod.itkImageRegistrationMethodIUC2IUC2_Pointer 
> _SetMe
> tric(*args)
>     509     def SetMovingImage(*args): return
> _itkImageRegistrationMethod.itkImageRegistrationMethodIUC2IUC2_Pointer 
> _SetMo
> vingImage(*args)
>     510     def SetOptimizer(*args): return
> _itkImageRegistrationMethod.itkImageRegistrationMethodIUC2IUC2_Pointer 
> _SetOp
> timizer(*args)
>
> <type 'exceptions.TypeError'>: Type error. Got
> _p_itk__KappaStatisticImageToImageMetricTitk__ImageTunsigned_char_2_t_ 
> itk__I
> mageTunsigned_char_2_t_t, expected
> _p_itk__SmartPointerTitk__ImageToImageMetricTitk__ImageTunsigned_char_ 
> 2_t_it
> k__ImageTunsigned_char_2_t_t_t
>
>
>
>  However, if I use a different metric, I have no problems, as  
> illustrated
> below:
>
> In [6]: imageMetric2  =  
> itk.MeanSquaresImageToImageMetric.IUC2IUC2.New()
>
> In [7]: registration.SetMetric(imageMetric2.GetPointer())
>
> In [8]: imageMetric2.GetPointer()
> Out[8]: <C itk::MeanSquaresImageToImageMetric<(itk::Image<(unsigned
> char,2)>,itk::Image<(unsigned char,2)>)> instance at
> _a0ce4d03_p_itk__MeanSquaresImageToImageMetricTitk__ImageTunsigned_cha 
> r_2_t_
> itk__ImageTunsigned_char_2_t_t>
>
>
> No type error.
>
> Any ideas as to what is happening? Any suggested fixes would be  
> appreciated.
>
> Brian
>
>
>  cannot get the
>

--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr





More information about the Insight-users mailing list