[ITK-users] Python wrapping issue

Paolo Zaffino p.zaffino at yahoo.it
Wed Oct 14 04:51:42 EDT 2015


Dear ITK community,
I compiled ITK 4.8 into an Ubuntu 14.04 machine enabling also the python 
wrapping.
Compiling the code took really a while and I had to restart the make 
phase more than one time since it crashed without any apparently reason.
Finally when the make step was over I executed the make install command.

If I open ipython and I type "import itkImagePython" it returns

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-dfd82b0a3e37> in <module>()
----> 1 import itkImagePython

/usr/local/lib/ITK-4.8/Python/itkImagePython.py in <module>()
      30                 fp.close()
      31             return _mod
---> 32     _itkImagePython = swig_import_helper()
      33     del swig_import_helper
      34 else:

/usr/local/lib/ITK-4.8/Python/itkImagePython.py in swig_import_helper()
      22             fp, pathname, description = 
imp.find_module('_itkImagePython', [dirname(__file__)])
      23         except ImportError:
---> 24             import _itkImagePython
      25             return _itkImagePython
      26         if fp is not None:

ImportError: No module named _itkImagePython

but if I run "import ITKRegionGrowingPython" it works.
In addition, after importing ITKRegionGrowingPython also itkImagePython 
works!

I think the path is correctly set, since I see 
/usr/local/lib/ITK-4.8/Python.
I also noted that in the "compiledFolder/lib" I see:

  * ITKRegionGrowingPython.py and _ITKRegionGrowingPython.so
  * itkImagePython.py but NOT _itkImagePython.so


Do you have any idea?

Furthermore, is it the syntax itk.something still valid or it has been 
replaced by separate submodules?
Because if I run
hm=itk.HistogramMatchingImageFilter()
I get
UnboundLocalError: local variable 'module' referenced before assignment

Thank you very much.
Regards.

Paolo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20151014/6807a162/attachment.html>


More information about the Insight-users mailing list