[Insight-users] ITK image to Numpy matrix and viceversa

Paolo Zaffino p.zaffino at yahoo.it
Wed Jan 30 12:06:49 EST 2013


Ok, now it crashes during the make step, when it tries to compile the 
pyBuffer module.
I think is wrong the path that I set for PYTHON_NUMARRAY_INCLUDE_DIR.
What is your setting for that variable?
I tried /usr/lib64/python2.7/site-packages/numpy/numarray/include/numpy 
and doesn't work.
I know that the first part is os dependent but after the python2.7 
location should be the same.

Thank you.
Paolo


Il 30/01/2013 15:21, Bradley Lowekamp ha scritto:
> Paolo,
>
> You are correct with the command line:
>
> git://github.com/tobiasmaier/itkPyBuffer.git Modules/External/itkPyBuffer
>
>
> When you place an ITK module into the ITK External or Remote 
> subdirectory, it become just like the build-in ITK modules. It gets 
> built along side of the rest of ITK, and also will get wrapped for 
> this case.
>
>
> After running the above command, I re-ran ccmake and it informed me 
> that PYTHON_NUMARRAY_INCLUDE_DIR, needed to be defined.
>
> The variable that needs to be set is Module_ITKBufferConvertion. This 
> should be enabled. I thought this use to come up in the CMake GUI, but 
> it did not for me. I had to go into the CMakeCache.txt file and 
> manually change the variable to ON to enable it.
>
> Hope that helps,
> Brad
>
> On Jan 30, 2013, at 8:57 AM, Paolo Zaffino <p.zaffino at yahoo.it 
> <mailto:p.zaffino at yahoo.it>> wrote:
>
>> Dear Brad,
>> thanks for your answer but I'm not yet able to get working that module.
>> First I think that the command is git clone 
>> git://github.com/tobiasmaier/itkPyBuffer.git 
>> Modules/External/itkPyBuffer, right?
>> Anyway I didn't understand how compile it, if I have to compile it 
>> before ITK or if it will be compiled during the itk building.
>> The problem is that I don't see the option to enable itkPyBuffer in 
>> the cmake step for ITK.
>>
>> Yes, I know of simpleITK, but in this case I need of ITK...anyway 
>> thanks for the advice.
>>
>> Thanks a lot.
>> Paolo
>>
>>
>>
>>
>> Il 29/01/2013 15:20, Bradley Lowekamp ha scritto:
>>> Hello Paolo,
>>>
>>> I have used the the following external module for get numpy support 
>>> for WrapITK:
>>>
>>> https://github.com/tobiasmaier/itkPyBuffer
>>>
>>>
>>> From the root ITK source dir just clone the repo into the 
>>> Modules/External directory:
>>>
>>> git clone git://github.com/tobiasmaier/itkPyBuffer.git Modules/External/
>>>
>>> Rerun ccmake, and turn on this module. And recompile.
>>>
>>>
>>> While you are waiting you can check to see if SimpleITK has the 
>>> functionality you need.
>>> I'd like to point out that SimpleITK has built in support for numpy, 
>>> and has binary eggs available for download.
>>> http://www.itk.org/Wiki/ITK/Release_4/SimpleITK
>>>
>>> Brad
>>>
>>> On Jan 29, 2013, at 8:46 AM, Paolo Zaffino <p.zaffino at yahoo.it 
>>> <mailto:p.zaffino at yahoo.it>> wrote:
>>>
>>>> Dear ITK community,
>>>>
>>>> I compiled ITK 4.3.1 with the Python support and all went fine.
>>>> I am able to run ITK functions from Python, but I'm also interested 
>>>> in converting an ITK image into a Numpy matrix and viceversa.
>>>> How can I do this?
>>>>
>>>> Thank you very much.
>>>> Regards.
>>>> Paolo
>>>> _____________________________________
>>>> Powered by www.kitware.com <http://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.php
>>>>
>>>> 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
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130130/b443b015/attachment.htm>


More information about the Insight-users mailing list