[Insight-users] Why are getBufferAs* methods not available in Java?

Dan Mueller dan.muel at gmail.com
Wed Mar 13 15:53:14 EDT 2013


Hi Mathew,

I proposed the sitk::Image::GetBufferAs methods specifically for the
problem you have encountered — an efficient way of transferring an
sitk::Image to a numeric array. (The sitk::ImportImageFilter allows
for conversion the other way from a numeric array to an sitk::Image).

However, my expertise is mainly in C# and so these methods are
currently only wrapped for the C# language. Python has a customized
conversion method using Numpy, which uses the GetBufferAs methods
under-the-hood.

So AFAIK the only reason the GetBufferAs methods are not available in
Java as yet is that the SimpleITK development team has not had the
know-how to wrap the methods specifically for Java. Do you know how
Java might interact with say GetBufferAsFloat which returns float* ?
Any input you have in order to improve SimpleITK is greatly
appreciated!

Cheers, Dan

On 14 March 2013 05:32, Mathew Guilfoyle <mrguilfoyle at gmail.com> wrote:
> Hi, I am trying to use the Java SimpleITK wrapper for medical image
> processing.
>
> I need to do some manipulation of the image as a plain numerical array
> before and after leveraging the ITK segmentation filters.  However, I can't
> find an efficient way of either transferring a numerical array to an SITK
> Image object or reverting an Image object back to a numerical array.  Using
> nested loops to do a per-pixel setPixelAs* or getPixelAs* operation takes an
> inordinate amount of time.
>
> I understand the getPixelContainer method is now deprecated (?) and was
> supposed to be replaced by the getBufferAs* methods, which I can see in the
> Doxygen Image class listing but seem to be suppressed in the Java wrapper
> (v0.6.1).  Is there a way round this?
>
> Many thanks for any help/advice
>
> Mathew
>
> _____________________________________
> 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
>


More information about the Insight-users mailing list