<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello Mathew,<div><br></div><div>Well using SimpleITK in Matlab via Java is quite another thing. This adds a couple more layers of interpretation and time.</div><div><br></div><div>Other people have told me they have done the conversion in a Java class and it performed much better then in Matlab.</div><div><br></div><div>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</div><div><br></div><div>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.</div><div><br></div><div>Here is the issue is JIRA:</div><div><a href="https://issues.itk.org/jira/browse/SIMPLEITK-40">https://issues.itk.org/jira/browse/SIMPLEITK-40</a></div><div><br><div><div>On Mar 13, 2013, at 9:56 PM, Mathew Guilfoyle <<a href="mailto:mrguilfoyle@gmail.com">mrguilfoyle@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">Thanks for the quick replies. I'm afraid I'm not that well versed in detailed Java development.<div><br></div><div>I'm a clinician using Matlab for imaging research and I'm interfacing to the Java wrapper of SimpleITK to use the segmentation tools.</div>
<div><br></div><div>Nonetheless, for my own interest and learning I will look into the wrapping of the getBufferAs* and see if I can make any progress.</div><div><br></div><div>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!</div>
<div><br></div><div>Thanks again, and for all the hard work on SimpleITK as a whole.</div><div><br></div><div>M<br><br><div class="gmail_quote">On 13 March 2013 19:53, Dan Mueller <span dir="ltr"><<a href="mailto:dan.muel@gmail.com" target="_blank">dan.muel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">Hi Mathew,<br>
<br>
I proposed the sitk::Image::GetBufferAs methods specifically for the<br>
problem you have encountered — an efficient way of transferring an<br>
sitk::Image to a numeric array. (The sitk::ImportImageFilter allows<br>
for conversion the other way from a numeric array to an sitk::Image).<br>
<br>
However, my expertise is mainly in C# and so these methods are<br>
currently only wrapped for the C# language. Python has a customized<br>
conversion method using Numpy, which uses the GetBufferAs methods<br>
under-the-hood.<br>
<br>
So AFAIK the only reason the GetBufferAs methods are not available in<br>
Java as yet is that the SimpleITK development team has not had the<br>
know-how to wrap the methods specifically for Java. Do you know how<br>
Java might interact with say GetBufferAsFloat which returns float* ?<br>
Any input you have in order to improve SimpleITK is greatly<br>
appreciated!<br>
<br>
Cheers, Dan<br>
<div class="HOEnZb"><div class="h5"><br>
On 14 March 2013 05:32, Mathew Guilfoyle <<a href="mailto:mrguilfoyle@gmail.com">mrguilfoyle@gmail.com</a>> wrote:<br>
> Hi, I am trying to use the Java SimpleITK wrapper for medical image<br>
> processing.<br>
><br>
> I need to do some manipulation of the image as a plain numerical array<br>
> before and after leveraging the ITK segmentation filters. However, I can't<br>
> find an efficient way of either transferring a numerical array to an SITK<br>
> Image object or reverting an Image object back to a numerical array. Using<br>
> nested loops to do a per-pixel setPixelAs* or getPixelAs* operation takes an<br>
> inordinate amount of time.<br>
><br>
> I understand the getPixelContainer method is now deprecated (?) and was<br>
> supposed to be replaced by the getBufferAs* methods, which I can see in the<br>
> Doxygen Image class listing but seem to be suppressed in the Java wrapper<br>
> (v0.6.1). Is there a way round this?<br>
><br>
> Many thanks for any help/advice<br>
><br>
> Mathew<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _____________________________________<br>
> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
</div></div></blockquote></div><br></div>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>