[Insight-users] Using itkPyBuffer

David Chen dchen at mail.nih.gov
Tue Jun 21 09:55:27 EDT 2011


I did the make install, and put in "import BufferConversion" and it worked.  As I had guessed, the problem was my newbie python ignorance.

Thanks for the help.

Dave

On Jun 20, 2011, at 7:02 PM, Gaëtan Lehmann wrote:

> 
> Hi David,
> 
> The simplest solution is probably to install PyBuffer, by running "make install".
> The PyBuffer class is then available directly in the itk module:
> 
>  itk.PyBuffer
> 
> If you don't have the rights required for the nistallation, then you'll have to add the path where the binaries are to your PYTHONPATH, as well as the path to the BufferConversion.py file.
> Something like:
> 
>  export PYTHONPATH=$PWD/lib:$PWD/Languages/Python/
> 
> then you should be able to import BufferConversion.
> 
> Please let us know if that fix your problem.
> 
> Gaëtan
> 
> 
> Le 20 juin 11 à 20:26, David Chen a écrit :
> 
>> I'm trying to build and use the PyBuffer external project in WrapITK.  I think I've built it ok, but when I try and run a test script, here's the error I get:
>> 
>> puget => test.py
>> Traceback (most recent call last):
>>  File "test.py", line 4, in <module>
>>    import itkPyBufferPython
>>  File "itkPyBufferPython.py", line 28, in <module>
>>    _itkPyBufferPython = swig_import_helper()
>>  File "itkPyBufferPython.py", line 20, in swig_import_helper
>>    import _itkPyBufferPython
>> ImportError: No module named _itkPyBufferPython
>> 
>> 
>> This is my simple test script:
>> 
>> #!/usr/bin/env python
>> 
>> import itk
>> import itkPyBufferPython
>> 
>> pixelType = itk.UC
>> imageType = itk.Image[pixelType, 2]
>> connector = itk.PyBuffer[imageType]
>> 
>> I am running the script in the lib sub-directory of my build directory.
>> 
>> 
>> David T. Chen, PhD                      [Lockheed Martin contractor]
>> mailto:dchen at mail.nih.gov               http://erie.nlm.nih.gov/~dave
>> phone:301.435.3264                      iphone:301.524.3174
>> Office of High Performance Computing and Communications
>> National Library of Medicine
>> 
>> _____________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
> 
> -- 
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> http://mima2.jouy.inra.fr  http://www.itk.org
> http://www.bepo.fr
> 

David T. Chen, PhD                      [Lockheed Martin contractor]
mailto:dchen at mail.nih.gov               http://erie.nlm.nih.gov/~dave
phone:301.435.3264                      iphone:301.524.3174
Office of High Performance Computing and Communications
National Library of Medicine

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110621/2627b32a/attachment-0001.htm>


More information about the Insight-users mailing list