[Insight-users] Why are getBufferAs* methods not available in Java?
Bradley Lowekamp
blowekamp at mail.nih.gov
Thu Mar 14 09:36:16 EDT 2013
Hello Mathew,
Well using SimpleITK in Matlab via Java is quite another thing. This adds a couple more layers of interpretation and time.
Other people have told me they have done the conversion in a Java class and it performed much better then in Matlab.
Still I think getting this raw buffer pointer interface is going to be significantly better and is they way to go. And the fact that this will help interface into Matlab should be add importance to the issue
There is a lot of interest in using SimpelITK in Matlab. I think few people know that you can use Java in Matlab and that the SimpleITK Java binding work there.
Here is the issue is JIRA:
https://issues.itk.org/jira/browse/SIMPLEITK-40
On Mar 13, 2013, at 9:56 PM, Mathew Guilfoyle <mrguilfoyle at gmail.com> wrote:
> Thanks for the quick replies. I'm afraid I'm not that well versed in detailed Java development.
>
> I'm a clinician using Matlab for imaging research and I'm interfacing to the Java wrapper of SimpleITK to use the segmentation tools.
>
> Nonetheless, for my own interest and learning I will look into the wrapping of the getBufferAs* and see if I can make any progress.
>
> For now I've come up with a more than satisfactory workaround by writing a couple of m-files that write out arrays to a .nii file and in turn import the file into ITK, then doing the reverse to get the post-processed image back into the Matlab workspace. Not elegant perhaps but far better than the 30+min it was taking with nested for loops of set/getPixel operations!
>
> Thanks again, and for all the hard work on SimpleITK as a whole.
>
> M
>
> On 13 March 2013 19:53, Dan Mueller <dan.muel at gmail.com> wrote:
> 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
> >
>
> _____________________________________
> 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/20130314/919376d8/attachment.htm>
More information about the Insight-users
mailing list