<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">Hello,</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">I am relatively new in working with
ITK, VTK and Python and this question may be a little bit silly, but I am having
some troubles in wrapping the ITK to Python. I first started using Cmake to
Configure both CableSwig and ITK for Visual Studio 10. I basically followed the tutorial in the
website:</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB"><a href="http://www.itk.org/Wiki/ITK/Tutorials">http://www.itk.org/Wiki/ITK/Tutorials</a></span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">After performing all the steps I was
unable to build successfully all the projects within ITK. I have tried to build CableSwig
outside and inside the ITK as was suggested in the website:</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB"><a href="http://www.itk.org/ITK/resources/CableSwig.html">http://www.itk.org/ITK/resources/CableSwig.html</a></span></p>


<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">but unsuccessfully. I finally gave
up and tried to use the ITK with Python Wrapping Installer:</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB"><a href="http://farsight-toolkit.org/wiki/FARSIGHT_Tutorials/Just_Installing_Software">http://farsight-toolkit.org/wiki/FARSIGHT_Tutorials/Just_Installing_Software</a></span></p>


<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">by simply installing it I have
access to the “.py” files with the ITK wrapped functions. I also added a “WrapITK.pth”
to the site-packages folder of the python release that I am using and it worked. Currently I have something like this:</span></p>

<p class="MsoListParagraphCxSpFirst" style="margin-bottom:6.0pt;line-height:normal"><span style="font-family:Symbol" lang="EN-GB"><span style>·<span style="font:7.0pt &quot;Times New Roman&quot;">        
</span></span></span><span style lang="EN-GB">$Project
Folder$\Python27\Lib\site-packages\ WrapITK.pth</span></p>

<p class="MsoListParagraphCxSpLast" style="margin-bottom:6.0pt;line-height:normal"><span style="font-family:Symbol" lang="EN-GB"><span style>·<span style="font:7.0pt &quot;Times New Roman&quot;">        
</span></span></span><span style lang="EN-GB">$Project
Folder$\InsightToolkit</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">Where the “InsightToolkit” was the
target installation folder of the ITK with Python Wrapping Installer.</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">The problem is I am capable of
importing ITK to Python, whether using the command line or any other IDE,
however I think it is not assumed as a Python package. For instance:</span></p>



<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">// Simple program for ITK image read/write in
Python</span></p>

<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">#!/usr/bin/env python</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">import itk</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">from sys import argv</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">pixelType = itk.UC</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">imageType = itk.Image[pixelType, 2]</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">readerType = itk.ImageFileReader[imageType]</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">writerType = itk.ImageFileWriter[imageType]</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">reader = readerType.New()</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">writer = writerType.New()</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">reader.SetFileName( argv[1] )</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">writer.SetFileName( argv[2] )</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">writer.SetInput( reader.GetOutput() )</span></p>


<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt">writer.Update()</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><br><span style="font-size:10.0pt"></span><span style lang="EN-GB"></span></p><p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal">
<span style lang="EN-GB"></span><span style lang="EN-GB"><a href="http://www.vtk.org/Wiki/ITK/Release_4/Wrapping/Examples">http://www.vtk.org/Wiki/ITK/Release_4/Wrapping/Examples</a></span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">I am capable of doing:</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:35.4pt;line-height:normal"><span style lang="EN-GB">pixelType =
itkTypes.UC</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">so I am capable of recognizing itkBase,
itkConfig, itkLazy, itkTypes, itkExtras, os, sys but I am unable to do the
second line </span></p>

<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:35.4pt;margin-bottom:.0001pt;text-indent:0cm;line-height:normal"><span style="font-size:10.0pt" lang="EN-GB">imageType = itk.Image[pixelType, 2]</span></p>


<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB"> </span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">What I get from the Python command line
is something like this:</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">Traceback (most recent call last): File
&quot;&lt;pyshell#3&gt;&quot;, line 1, in &lt;module&gt; imageType =
itk.Image[pixelType,2] </span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">File &quot;... \InsightToolkit\lib\InsightToolkit\WrapITK\Python\itkLazy.py&quot;,
line 18, in __getattribute__ itkBase.LoadModule(module, namespace)</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">File &quot;...\InsightToolkit\lib\InsightToolkit\WrapITK\Python\itkBase.py&quot;,
line 24, in LoadModule swig.__dict__.update(this_module.swig.__dict__) AttributeError:
&#39;module&#39; object has no attribute &#39;swig&#39;</span></p>



<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB"> </span></p><p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">Does anyone has/had this problem? What am I doing wrong?<br>
</span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB"> </span></p>

<p class="MsoNormal" style="margin-bottom:6.0pt;text-indent:0cm;line-height:normal"><span style lang="EN-GB">Best Regards and thank you very much!<br></span></p>