<div dir="ltr"><div>Thank you for everyone getting back to me. I have had a play with the paths, and carried out all your suggestions. But I still have no luck. The problem I have firstly with the paths is that my itk.py file is<span style="font-family:arial,sans-serif;font-size:13px"><font color="#000000"> </font></span><span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:13px">sys.path.append('C:/</span><span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:13px">Toolkits/ITK-4.5.1/build_x64_</span><span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:13px">VS2008_withLTK/Wrapping/</span><span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:13px">Generators/Python/Release'), </span><span style="font-family:arial,sans-serif;font-size:13px"><font color="#000000">along with itkBase.py, itkConfig.py, itkLazy.py, itkTemplate.py, itkTypes.py and the WrapITK.path. </font></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><font color="#000000"><br></font></span></div><div>There is no itk.py in<span style="font-family:arial,sans-serif;font-size:13px"> </span><span style="color:rgb(0,0,255);font-family:arial,sans-serif;font-size:13px">sys.path.append('C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python') </span><span style="font-family:arial,sans-serif;font-size:13px"><font color="#000000">that was suggested, but what I do have is InsightToolkit.py here (amongst many other python files). When I import InsightToolkit.py (after adding the lib path), I get this error:</font></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><font color="#000000"><br></font></span></div><div><p style="margin:0px"><span style="color:rgb(0,0,150);font-family:Courier;font-size:8.25pt">>>> import InsightToolkit</span></p>
<div class="im"><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000">Traceback (most recent call last):</font></span></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "<console>", line 1, in <module></font></span></p>
</div><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "C:\Toolkits\ITK-4.5.1\build_x64_VS2008_withLTK\Wrapping\Generators\Python\Configuration\..\InsightToolkit.py", line 5, in <module></font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> from ITKPyBase import *</font></span></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "C:\Toolkits\ITK-4.5.1\build_x64_VS2008_withLTK\Wrapping\Generators\Python\Configuration\..\ITKPyBase.py", line 2, in <module></font></span></p>
<div class="im"><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> itkBase.LoadModule('ITKPyBase')</font></span></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py", line 103, in LoadModule</font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> if not swigModuleName in sys.modules: module = loader.load(swigModuleName)</font></span></p></div><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py", line 214, in load</font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> return imp.load_module(name, fp, pathname, description)</font></span></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/lib\ITKPyBasePython.py", line 30, in <module></font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> _ITKPyBasePython = swig_import_helper()</font></span></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/lib\ITKPyBasePython.py", line 22, in swig_import_helper</font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> import _ITKPyBasePython</font></span></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000">ImportError: No module named _ITKPyBasePython</font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"><br></font></span></p><p style="margin:0px"><span style="font-family:arial,helvetica,sans-serif">I've checked and there is an ITKPyBasePython.py in the lib folder.</span><span style="font-family:arial,helvetica,sans-serif"> </span></p>
<p style="margin:0px"><font color="#000000" face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px"><font color="#000000" face="arial, helvetica, sans-serif">For trying the ImageType = itk.Image[itk.US, 3], the error I'm getting </font></p>
<p style="margin:0px"><span style="color:rgb(0,0,150);font-family:Courier;font-size:8.25pt">>>> imageType = itk.Image[itk.US, 3]</span></p><div class="im"><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000">Traceback (most recent call last):</font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "<console>", line 1, in <module></font></span></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkLazy.py", line 37, in __getattribute__</font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> itkBase.LoadModule(module, namespace)</font></span></p></div><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> File "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py", line 42, in LoadModule</font></span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000"> swig.__dict__.update(this_module.swig.__dict__)</font></span></p><p style="margin:0px"></p><p style="margin:0px"><span style="font-family:Courier;font-size:8.25pt"><font color="#ff0000">AttributeError: 'module' object has no attribute 'swig'</font></span></p>
<p style="margin:0px"><span style="color:rgb(0,0,150);font-family:Courier;font-size:8.25pt"><br></span></p><p style="margin:0px"><font color="#000000" face="arial, helvetica, sans-serif">There seems to be some issue with swig, but I don't understand how it works and hence why mine isn't working. Any ideas anyone?</font></p>
<p style="margin:0px"><font color="#000000" face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0px"><font color="#000000" face="arial, helvetica, sans-serif">Cheers,</font></p><p style="margin:0px"><font color="#000000" face="arial, helvetica, sans-serif">Nicole</font></p>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-31 14:36 GMT+01:00 Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chiara,<br>
<br>
If the file 'WrapITK.pth' from Wrapping/Generators/Python/ iin the<br>
build tree is copied to the site-packages directory of your Python<br>
distribution, it should help.<br>
<span class="HOEnZb"><font color="#888888"><br>
Matt<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Mon, Mar 31, 2014 at 8:07 AM, Paolo Zaffino <<a href="mailto:p.zaffino@yahoo.it">p.zaffino@yahoo.it</a>> wrote:<br>
> Hi,<br>
> I confirm your wrong path.<br>
> Anyway I usually add also:<br>
><br>
> sys.path.append("YOUR_BUILD_PATH/lib")<br>
> Maybe this can help.<br>
><br>
> Paolo<br>
> Il Lunedì 31 Marzo 2014 11:03, Michka Popoff <<a href="mailto:michkapopoff@gmail.com">michkapopoff@gmail.com</a>> ha<br>
> scritto:<br>
> Hi<br>
><br>
> seems your path is not correctly set. The path should be :<br>
> sys.path.append('C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python')<br>
> There is no Release folder in the Python folder.<br>
> Maybe you'll have to play a little bit with the path, you are under windows<br>
> so perhaps the slashes need to be replaced by backslashes ?<br>
><br>
> Michka<br>
><br>
> Le 31 mars 2014 à 10:38, Chiara Caborni a écrit :<br>
><br>
> Hello,<br>
><br>
> I'm writing on behalf of Nicole in cc, which has subscribed to<br>
> <a href="mailto:insight-users@itk.org">insight-users@itk.org</a>, but still cannot send mails directly to the<br>
> community, can you do something about that? thank you<br>
><br>
><br>
> I'm trying to use the python wrapped ITK, but I'm running into trouble<br>
> setting up my image type.<br>
><br>
><br>
><br>
> My code so far:<br>
><br>
> import sys<br>
><br>
> sys.path.append('C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release')<br>
><br>
> import itk<br>
><br>
> pixelType = itk.UC<br>
><br>
> imageType = itk.Image[pixelType,3]<br>
><br>
><br>
><br>
> Traceback (most recent call last):<br>
><br>
> File "<console>", line 1, in <module><br>
><br>
> File<br>
> "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkLazy.py",<br>
> line 37, in __getattribute__<br>
><br>
> itkBase.LoadModule(module, namespace)<br>
><br>
> File<br>
> "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py",<br>
> line 95, in LoadModule<br>
><br>
> LoadModule(dep, namespace)<br>
><br>
> File<br>
> "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py",<br>
> line 95, in LoadModule<br>
><br>
> LoadModule(dep, namespace)<br>
><br>
> File<br>
> "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py",<br>
> line 95, in LoadModule<br>
><br>
> LoadModule(dep, namespace)<br>
><br>
> File<br>
> "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py",<br>
> line 95, in LoadModule<br>
><br>
> LoadModule(dep, namespace)<br>
><br>
> File<br>
> "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py",<br>
> line 95, in LoadModule<br>
><br>
> LoadModule(dep, namespace)<br>
><br>
> File<br>
> "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py",<br>
> line 103, in LoadModule<br>
><br>
> if not swigModuleName in sys.modules: module = loader.load(swigModuleName)<br>
><br>
> File<br>
> "C:/Toolkits/ITK-4.5.1/build_x64_VS2008_withLTK/Wrapping/Generators/Python/Release\itkBase.py",<br>
> line 213, in load<br>
><br>
> fp, pathname, description = imp.find_module(name)<br>
><br>
><br>
><br>
> Can anyone help me understand why this is happening and what I can do about<br>
> it?<br>
><br>
><br>
><br>
> Cheers,<br>
><br>
> Nicole<br>
> --<br>
> Chiara<br>
><br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
><br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
><br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Chiara
</div>