[Insight-users] problems setting the interpolator in the WarpImageFilter

Aldo Mejia Rodriguez armero83 at gmail.com
Wed May 30 06:26:45 EDT 2012


Hi everybody

I'm using ITK with Python and right now I'm working with the
DeformableRegistration2 example.

the python code I've generated works, except when I try to set the
interpolator to the WarpImageFilter, here is the part of the code where I
have the problem:

##########################################################
Dimension=2
PixelType=itk.US
MovingImageType=itk.Image[PixelType, Dimension]

VectorPixelType=itk.Vector[itk.F, Dimension]
DeformationFieldType=itk.Image[VectorPixelType, Dimension]


warper=itk.WarpImageFilter[MovingImageType,
                           MovingImageType,
                           DeformationFieldType].New()

interpolator=itk.LinearInterpolateImageFunction[MovingImageType,
                                                itk.D].New()


#HERE IS THE PROBLEM
warper.SetInterpolator(interpolator)
############################################################

After the last line of code i got this error:


Traceback (most recent call last):
  File "<pyshell#17>", line 1, in <module>
    warp.SetInterpolator(interpolator)
  File "/usr/lib/python2.7/dist-packages/itkWarpImageFilter.py", line 818,
in SetInterpolator
    def SetInterpolator(*args): return
_itkWarpImageFilter.itkWarpImageFilterIUS2IUS2IVF22_Pointer_SetInterpolator(*args)
TypeError: Type error. Got
_p_itk__SmartPointerTitk__LinearInterpolateImageFunctionTitk__ImageTunsigned_short_2u_t_double_t_t,
expected
_p_itk__SmartPointerTitk__InterpolateImageFunctionTitk__ImageTunsigned_short_2u_t_double_t_t


Any idea how to fix this problem???

One more question...the WarpImageFilter has a default interpolator??? I ask
cause if I comment (or eliminate) the SetInterpolator line of code, all the
rest of the code works without any problem

In advance thanks for your time
A.

-- 
M.Sc. Aldo Rodrigo Mejia Rodriguez
PhD Student - Bioengineering department - Politecnico di Milano (IT)
Istituto di Bioimmagini e Fisiologia Molecolare (IBFM), CNR (IT)
Via Fratelli Cervi 93
20090 Segrate (Milano)

contacts
office: 0221717218
mail: armero83 at gmail.com , aldo.mejia at mail.polimi.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120530/107b7720/attachment.htm>


More information about the Insight-users mailing list