[ITK] [ITK-users] ITK 4.6.0 Python Wrapping (swig?) problem
Michka Popoff
michkapopoff at gmail.com
Tue Sep 30 07:03:33 EDT 2014
Hi
once ITK is compiled, there is no more need for Swig at runtime.
For the syntax, you should use the new wrapping syntax.
Look at how it is done in this example, at the end there is python code [1]
I would recommend you not to use system swig, this is mostly an option for people wanting to play around with external versions of swig.
If you want to be sure it works, just set ITK_USE_SYSTEM_SWIG=OFF. ITK will download, compile and use an internal swig.
You can find a detailed tutorial for the installation here : http://www.itk.org/Wiki/ITK/WrapITKInstallFedora
The tutorial should work for Ubuntu 14, I never tried but one user reported being able to install ITK wrappings with this tutorial.
[1] http://itk.org/ITKExamples/src/Filtering/AnisotropicSmoothing/ComputeCurvatureAnisotropicDiffusion/Documentation.html
Michka
On 30 sept. 2014, at 12:51, Sami Koho <sakoho at utu.fi> wrote:
> Hello,
>
> this week I tried to upgrade my ITK installation on my Ubuntu 14.04 (64 bit) to the 4.6.0 release version, as it promised much improved Python wrapping. I had previously been using some pre-4.6 build from GIT. The library compiles fine, but now the Python wrapping does not work on my computer.
>
> I am able to load itk in Python, but every time I try to execute anything, the following error appears:
>
>> <ipython-input-12-8e289c4078ab> in <module>()
>> ----> 1 reader = itk.ImageFileReader.IUC3.New()
>>
>> /usr/local/lib/ITK-4.6/Python/itkLazy.py in __getattribute__(self, attr)
>> 40 module = self.__lazy_attributes[attr]
>> 41 namespace = {}
>> ---> 42 itkBase.LoadModule(module, namespace)
>> 43 # Load into 'namespace' first, then self.__dict__ (via setattr) to
>> 44 # prevent the warnings about overwriting the 'NotLoaded' values
>>
>> /usr/local/lib/ITK-4.6/Python/itkBase.py in LoadModule(name, namespace)
>> 51 if namespace is not None:
>> 52 swig = namespace.setdefault('swig', imp.new_module('swig'))
>> ---> 53 swig.__dict__.update(this_module.swig.__dict__)
>> 54
>> 55 # don't worry about overwriting the symbols in namespace -- any
>>
>> AttributeError: 'module' object has no attribute 'swig'
>
> I have had this problem before, but previously on Ubuntu I solved it by selecting USE SYSTEM SWIG in CMAKE before compiling. Now, as the version 4.6.0 requires a newer version of swig, this does not work. As a further detail, if I try to manually insert a command, for example in iPython, tab-completion works until the module names e.g. itk.ImageFileReader, but then stops. It seems that the swig can not be found or is not working properly.
>
> Should I manually set a path to swig? Or is something else wrong instead?
>
> I have installed ITK in the default path /usr/local/lib, as can be seen from the example.
>
> Best,
>
> Sami
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list