Let's do devide questions also on the DeVIDE mailing list, that's good
for everyone!
To convert from itk image to numpy array, try the following in an
introspection window:
import itk
my_numpy_array = itk.PyBuffer[itk.Image.F3].GetArrayFromImage(your_itk_img)
(this should work on Linux 64bit DeVIDE at the least and probably
Linux 32bit. I just noticed that the Windows version for some or other
reason doesn't ship with PyBuffer :(
You *can* access voxels directly:
if3.SetPixel(itk.Index[3]((0,0,0)), 20)
(my memory is rusty, I needed a few minutes of Python introspection to
discover this)
On Sun, Apr 22, 2012 at 19:00, Christian Kehl <dj.k...@googlemail.com> wrote:
> In classical C++ style ITK, I got that it can be done by direct access - but
> I haven't been able to map that to python. Another way there is iterators,
> but we don't have such things in python ...
>
> A way would be - apart from installing SimpleITK or even bigger stuff - to
> get the ITK image into a python array (numpy/scipy - great idea Francois).
> Now, for that idea google puts out answers to itk.pybuffer - like these page
> here:
>
> http://paulnovo.us/wrapitktutorial
> https://medipy.googlecode.com/hg-history/5b17b5c542ddc73e57cb111fcd390b934aa936cb/lib/itk/numpy_bridge.py
>
> I had a look into DeVIDE by opening a python console there - pybuffer is
> missing, no valid object there.
>
> Does anybody have an idea how to solve that ? Anybody else of you already
> stoof in front of the problem ?