[ITK] [ITK-users] ITK Python: numpy to itk image (and viceversa)
D'Isidoro Fabio
fisidoro at ethz.ch
Sun Apr 2 17:17:50 EDT 2017
Hallo,
I use ITK with Python Wrap. I need to interface my Python code with a Cython-wrapped C++ code that takes only numpy array as input and returns numpy array as output.
Hence, I need to convert the Python itk images into numpy array to be given as input to the wrapped C++ code, and then convert the numpy array in output from the wrapped C++ code back into python itk images.
Question 1) How can I do that in an efficient way? I found some posts on itk.PyBuffer but I could not find anywhere any reference on how to install it on my itk wrap build.
Question 2) The purpose of writing a part of my algorithm in C++ is to speed up the code. If the conversion between python itk images and numpy arrays is slow, I would lose all the speed gain obtained with the C++ implementation. Are there better ways to deal with that?
Thank you,
Fabio.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170402/d659628b/attachment.html>
-------------- next part --------------
_____________________________________
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.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://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list