[Insight-users] SimpleITK Python parallel processing

Bradley Lowekamp blowekamp at mail.nih.gov
Fri Nov 30 13:11:03 EST 2012


Hello Brian,

You are correct that the sitk::Image does not currently have pickling implemented.  I don't know if there is a simple work around to implement this method on the python end. But you can alway use the GetArrayFromImage, and GetImageFromArray methods to covert the images to and fro a numpy array. It's an extra copy but a work around for now.


What access to ITK's multithreading do you want? SimpleITK's image filters should default to being multithreaded just like ITK's. If you want to specify the number of threads a filter create by default the environmental variable "ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS" can be set before any code in SimpleITK is executed.

Brad

On Nov 30, 2012, at 12:50 PM, "Chapman, Brian" <brchapman at ucsd.edu> wrote:

> I'm using SimpleITK for a script and want to exploit the multiple cores on a computer. I cannot use the Python multiprocessing library because the SimpleITK objects cannot be pickled:
> 
> PicklingError: Can't pickle <type 'SwigPyObject'>: attribute lookup __builtin__.SwigPyObject failed.
> 
> There doesn't seem to be any Python access to the multithreading features of the C++ class.
> 
> Any suggestions for an alternative approach?
> 
> Brian
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users

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


More information about the Insight-users mailing list