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

alex sando yejun.alex at gmail.com
Wed Nov 18 03:11:56 EST 2009


> Thanks Gaëtan,  I built itkvtkglue project successfully:
>
> 1>------ Build started: Project: INSTALL, Configuration: Release Win32
> ------
> 1>
> 1>Performing Post-Build Event...
> 1>-- Install configuration: "Release"
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/include/InsightToolkit/BasicFilters/itkImageToVTKImageFilter.h
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/include/InsightToolkit/BasicFilters/itkImageToVTKImageFilter.txx
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/include/InsightToolkit/BasicFilters/itkVTKImageToImageFilter.h
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/include/InsightToolkit/BasicFilters/itkVTKImageToImageFilter.txx
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/ClassIndex/ItkVtkGlue.mdx
> 1>-- Installing: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/lib/_ItkVtkGluePython.pyd
> 1>-- Installing: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/ClassIndex/wrap_ItkVtkGluePython.idx
> 1>-- Installing: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/lib/ItkVtkGluePython.py
> 1>-- Installing: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/ClassIndex/wrap_itkImageToVTKImageFilter.idx
> 1>-- Installing: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/lib/itkImageToVTKImageFilter.py
> 1>-- Installing: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/ClassIndex/wrap_itkVTKImageToImageFilter.idx
> 1>-- Installing: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/lib/itkVTKImageToImageFilter.py
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/SWIG/ItkVtkGlue.swg
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/Python/Configuration/ItkVtkGlueConfig.py
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/Python/ItkVtkGlue.py
> 1>-- Installing external project  into the WrapITK installation directory.
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/Python/itkvtk.py
> 1>-- Up-to-date: C:/Program
> Files/ItkVtkGlue/lib/InsightToolkit/WrapITK/Python/itkExtras/itkvtkExtras.py
> 1>Build log was saved at
> "file://d:\ITKVTKBuild\INSTALL.dir\Release\BuildLog.htm"
> 1>INSTALL - 0 error(s), 0 warning(s)
> ========== Build: 1 succeeded, 0 failed, 4 up-to-date, 0 skipped ==========
>
> But i still get error message when import the module:
>
> import ItkvtkGlue
> ImportError: No module named ItkvtkGlue
> or
> import itkvtk
> ImportError: No module named itkvtk
>
> So I guess VTKImageToImageFilter may be built into the itk module, so i try
> the filter directly in the source code without the extra "import"
> expressions:
>
> print "Start to OpenFile"
> convertor = itk.VTKImageToImageFilter[itk.Image.US3].New(imageData)
>
> img = convertor.GetOutput()
> convertor.Update();
> print "Finished OpenFile"
>
> , but only get:
>
>
> AttributeError: 'LazyITKModule' object has no attribute
> 'VTKImageToImageFilter'
>
> How can i fix this.... many many thanks for suggestions...
>
> Alex
>
>
> 2009/11/18 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>
>
>
>> Le 17 nov. 09 à 07:59, alex sando a écrit :
>>
>>
>>  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...
>>>
>>
>> It is in WrapITK, but in an external project.
>> See Wrapping/WrapITK/ExternalProjects/ItkVtkGlue
>>
>> Gaëtan
>>
>>
>>
>>> 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
>>>
>>>
>>>
>>>
>> --
>> 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/20091118/f505de57/attachment.htm>


More information about the Insight-users mailing list