[Insight-users] problem with python and itk

Kayhan Batmanghelich kayhan_batman at yahoo.com
Fri Jun 15 00:23:44 EDT 2007


Hi all,


I have a problem with CSWIG cable and ITKwrapping and I would be thankful if you could help. I sent similar post two weeks back when I wanted to test python and ITK on my 64bit machine. Since I realized that python2.5 and CSWIG and ITK on 64bit cannot get along with each other, I wanted to  test it on my laptop (32bit). This time, it was compiled although it crashed once complaining about a bug in gcc but I resume compiling typing "make" again. After compilation was finished (it took hours !!), I add following lines to my .bashrc file:
    PATH=/home/kayhan/bin/InsightToolkit-3.2.0/Wrapping/WrapITK/Python:$PATH
    export PATH
    export PYTHONPATH=/home/kayhan/bin/InsightToolkit-3.2.0/Wrapping/WrapITK/Python:$PYTHONPATH
    export LD_LIBRARY_PATH=/home/kayhan/bin/InsightToolkit-3.2.0/bin:$LD_LIBRARY_PATH
    Once I wanted to try it on python (ipython environment), these error messages turn out:
    In [1]: import itk
    In [2]: dim = 3
    In [3]: PixelType = itk.UC
    In [4]: Image = itk.image[P
    PendingDeprecationWarning  PixelType                  
    In [4]: Image = itk.image[PixelType, dim]
    ---------------------------------------------------------------------------
    <type 'exceptions.TypeError'>             Traceback (most recent call last)

- Ignored:
    /home/kayhan/<ipython console> in <module>()
    
    <type 'exceptions.TypeError'>: 'function' object is unsubscriptable
    
    
    first I thought that there might be something wrong with ITKWrapping, therefore I add CSWIG path to PYTHONPATH variable and tried to check using itk through python using CSWIG, I got following:
    
    kayhan at kayhan-laptop:~$ export PYTHONPATH=/home/kayhan/bin/InsightToolkit-3.2.0/Wrapping/CSwig/Python/:$PYTHONPATH
    kayhan at kayhan-laptop:~$ python
    Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
    [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from InsightToolkit import *
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/kayhan/bin/InsightToolkit-3.2.0/Wrapping/CSwig/Python/InsightToolkit.py", line 1, in <module>
        from itkalgorithms import *
      File "/home/kayhan/bin/InsightToolkit-3.2.0/Wrapping/CSwig/Python/itkalgorithms.py", line 1, in <module>
        from itknumerics import *
      File "/home/kayhan/bin/InsightToolkit-3.2.0/Wrapping/CSwig/Python/itknumerics.py", line 1, in <module>
        from itkcommon import *
      File "/home/kayhan/bin/InsightToolkit-3.2.0/Wrapping/CSwig/Python/itkcommon.py", line 1, in <module>
        from vxlnumerics import *
      File "/home/kayhan/bin/InsightToolkit-3.2.0/Wrapping/CSwig/Python 2.5.1 (r251:54863, May  2 2007, 16:56:35) Python 2.5.1 (r251:54863, May  2 2007, 16:56:35) Python/vxlnumerics.py", line 4, in <module>
        from VXLNumericsPython import *
      File "VXLNumericsPython.py", line 33, in <module>
        from vcl_complex import *
      File "vcl_complex.py", line 5, in <module>
        import _vcl_complex
    ImportError: No module named _vcl_complex
    
    
    
    
    Do you think that there is something wrong with configuration or I should redo compilation or ...? By the way, here is my machine specification:
    
    Linux Ubuntu 7.04 (32bit)
    gcc: version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
    ITK ver.: InsightToolkit-3.2.0
    python ver.: Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
    
    
    I would be thankful if you reply me back.
    
    
    Regards,
    Kayhan 



 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070614/13ec930f/attachment.htm


More information about the Insight-users mailing list