[ITK-users] [ITK] WrapITK question: how to cast images with RGB or complex float pixel types to a Numpy array?

Lowekamp, Bradley (NIH/NLM/LHC) [C] blowekamp at mail.nih.gov
Mon Jun 20 11:18:24 EDT 2016


Hello,

In C++ ITK I would just use the CastImageFilter inplace to convert from RGBPixel to a vector type. But that doesn’t seemed to be wrapped:

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageFilterBase/wrapping/itkCastImageFilter.wrap

I would look into extending the pyBuffer to support the RGBPixel type:

https://github.com/tobiasmaier/itkPyBuffer/blob/master/wrapping/itkPyBuffer.wrap

There should be some information documenting this in the ITK software guide:
https://itk.org/ITK/help/documentation.html

HTH,
Brad

On Jun 20, 2016, at 9:49 AM, Edwin Bennink <hebennink at gmail.com<mailto:hebennink at gmail.com>> wrote:

Hello,


I am searching for a way to access pixel data of unsigned char RGBPixel images and complex float images in Numpy through PyBuffer.

I guess that it should be possible to cast these images to a vector type and access the data without copying, but I can't figure out how. PyBuffer doesn't support RGB or complex images, and it feels stupid to decompose and recompose into a vector image.

What would be a neat solution to this problem? Thanks!


Edwin Bennink
_____________________________________
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://public.kitware.com/mailman/listinfo/insight-users
_______________________________________________
Community mailing list
Community at itk.org
http://public.kitware.com/mailman/listinfo/community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20160620/50ae5f70/attachment.html>


More information about the Insight-users mailing list