<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" bgcolor="#FFFFFF">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Paolo,<br>
<div><br>
Why you want to import itkImagePython instead of just itk?<br>
<br>
import itk<br>
img = itk.Image.F3.New()<br>
<br>
should work as previously. Notice that<br>
itk.HistogramMatchingImageFilter()<br>
would not work in any case since you need to define the types as well.<br>
<br>
The modular design of ITK 4 should not have effected the interface of ITK Python wrappings in anyway. If I'm wrong then maybe someone can correct me.<br>
<br>
So I would first check that you are able to import itk and load some filter. If not, then check that all shared libs are in search path.<br>
<br>
Cheers,<br>
Lassi<br>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF915797"><font face="Tahoma" size="2" color="#000000"><b>From:</b> Insight-users [insight-users-bounces@itk.org] on behalf of Paolo Zaffino [p.zaffino@yahoo.it]<br>
<b>Sent:</b> Wednesday, October 14, 2015 11:51<br>
<b>To:</b> insight-users@itk.org<br>
<b>Subject:</b> [ITK-users] Python wrapping issue<br>
</font><br>
</div>
<div></div>
<div>Dear ITK community,<br>
I compiled ITK 4.8 into an Ubuntu 14.04 machine enabling also the python wrapping.<br>
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.<br>
Finally when the make step was over I executed the make install command.<br>
<br>
If I open ipython and I type "import itkImagePython" it returns<br>
<br>
---------------------------------------------------------------------------<br>
ImportError                               Traceback (most recent call last)<br>
<ipython-input-1-dfd82b0a3e37> in <module>()<br>
----> 1 import itkImagePython<br>
<br>
/usr/local/lib/ITK-4.8/Python/itkImagePython.py in <module>()<br>
     30                 fp.close()<br>
     31             return _mod<br>
---> 32     _itkImagePython = swig_import_helper()<br>
     33     del swig_import_helper<br>
     34 else:<br>
<br>
/usr/local/lib/ITK-4.8/Python/itkImagePython.py in swig_import_helper()<br>
     22             fp, pathname, description = imp.find_module('_itkImagePython', [dirname(__file__)])<br>
     23         except ImportError:<br>
---> 24             import _itkImagePython<br>
     25             return _itkImagePython<br>
     26         if fp is not None:<br>
<br>
ImportError: No module named _itkImagePython<br>
<br>
but if I run "import ITKRegionGrowingPython" it works.<br>
In addition, after importing ITKRegionGrowingPython also itkImagePython works!<br>
<br>
I think the path is correctly set, since I see /usr/local/lib/ITK-4.8/Python.<br>
I also noted that in the "compiledFolder/lib" I see:<br>
<ul>
<li>ITKRegionGrowingPython.py and _ITKRegionGrowingPython.so </li><li>itkImagePython.py but NOT _itkImagePython.so </li></ul>
<br>
Do you have any idea?<br>
<br>
Furthermore, is it the syntax itk.something still valid or it has been replaced by separate submodules?<br>
Because if I run<br>
hm=itk.HistogramMatchingImageFilter()<br>
I get <br>
UnboundLocalError: local variable 'module' referenced before assignment<br>
<br>
Thank you very much.<br>
Regards.<br>
<br>
Paolo </div>
</div>
</div>
</body>
</html>