[Insight-users] Problem with wrapping itk with python 2.3

alex sando yejun.alex at gmail.com
Tue Nov 17 01:59:58 EST 2009


hi, currently i want to import a vtkImageData to itkImage so that the data
could be processed using some ITK filters, but when i execute the following
code:

        imageData = reader.GetOutput()
        print "Start to OpenFile"
        convertor = itk.VTKImageToImageFilter[itk.Image.S3].New(imageData)
        img = convertor.GetOutput()
        convertor.Update();
        print "Finished OpenFile"

always get the following error message:
  File "D:\Lab Affairs\src\control\Common.py", line 448, in _simpleProcess
    convertor = itk.VTKImageToImageFilter[...].New(imageData)
  File "C:\Program
Files\WrapITK\lib\InsightToolkit\WrapITK\Python\itkLazy.py", line 14, in
__getattribute__
    value = types.ModuleType.__getattribute__(self, attr)
AttributeError: 'LazyITKModule' object has no attribute
'VTKImageToImageFilter'

VTKImageToImageFilter is not wrapped in the WrapITK? how can i convert the
image from & to between vtkImageData and itkImage? thanks...

Regards,

Alex

On Tue, Nov 17, 2009 at 1:20 PM, alex sando <yejun.alex at gmail.com> wrote:

> Thanks Gaëtan! It seems work well on my platform:). Some little issues i
> encountered in the progress, just a record for later's reference :).
> 1. _BasePython project in WrapITK failed because /bigobj compile flag is
> not set defaultly.
> 2. Dont forget to add path which contains SwigRuntimePython.dll to PATH
>
> Regards,
>
> Alex
>
> 2009/11/17 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>
>
>
>> Le 16 nov. 09 à 19:14, alex sando a écrit :
>>
>>
>>  hello Gaëtan
>>>
>>> Currently i use itk 3.14 and Cableswig 3.14 and wrapitk0.2 in the source
>>> of itk 3.14. But when i build wrapitk, it failed with a lot of
>>> "itkFlatStructuringElement.h: No such file or directory" error.... can you
>>> give me any suggestion to solve this? many thanks, my platform is xp with
>>> vs2005 and cmake 2.8.
>>>
>>
>> Sure: turning on ITK_USE_REVIEW in cmake gui should help.
>> Please let me know if that fix your problem.
>>
>> Regards,
>>
>> Gaëtan
>>
>>
>>
>>
>>> Regards,
>>>
>>> Alex
>>>
>>> 2009/11/16 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>
>>>
>>> Le 16 nov. 09 à 13:32, alex sando a écrit :
>>>
>>>
>>> hi all,
>>>  I am currently working on an legacy system which is composed under
>>> python 2.3. Is there any method that could help me to create the itk python
>>> wrap under python 2.3? I search for a while on the internet and find the
>>> wrapitk is a great tool for using itk under python environment, but its
>>> requirement for  the version of python is at least 2.4...I also tried to
>>> compile the wrap using cmake, but failed with
>>>
>>>
>>> CMake Warning at CMakeLists.txt:173 (FIND_PACKAGE):
>>> Could not find module FindCableSwig.cmake or a configuration file for
>>> package CableSwig.
>>> Adjust CMAKE_MODULE_PATH to find FindCableSwig.cmake or set CableSwig_DIR
>>> to the directory containing a CMake configuration file for CableSwig. The
>>> file will have one of the following names:
>>> CableSwigConfig.cmake
>>> cableswig-config.cmake
>>> CMake Error at CMakeLists.txt:185 (MESSAGE):
>>> CableSwig is required for CSwig Wrapping.
>>> Configuring incomplete, errors occurred!
>>>
>>> But in fact i set the CableSwig_DIR directory correctly... Is there any
>>> suggestion to get itk work under python 2.3.....great appreciate....
>>>
>>>
>>> Hi Alex,
>>>
>>> I think that WrapITK 0.2 - in ITK sources - *should* work with python
>>> 2.3.
>>>
>>> Can you give more informations on your system? OS, cmake version,
>>> compiler, ITK version, CableSwig version, …
>>>
>>>
>>> Regards,
>>>
>>> Gaëtan
>>>
>>>
>>> --
>>> 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  http://www.itk.org
>>> http://www.mandriva.org  http://www.bepo.fr
>>>
>>>
>>>
>> --
>> 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  http://www.itk.org
>> http://www.mandriva.org  http://www.bepo.fr
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091117/adbea0db/attachment.htm>


More information about the Insight-users mailing list