[Insight-users] Problem grafting a C++ array as an ImageToImageFilter output

Ramón Casero Cañas rcasero at gmail.com
Fri Aug 9 08:31:24 EDT 2013


Hi, sorry for the very slow reply.

On 30 May 2013 13:41, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:

> Hello,
>
> There a many options to choose from to minimize memory. Some filter run
> in-place, and re-use the input buffer on the output.
>
> Can you use the image buffer from ITK and import it into matlab? Does
> matlab not have the ability to import a buffer?
>

Not as far as I know. I think the main problem is that once the mex
function runs, everything that has not been allocated with a MEX API
function, e.g.

http://www.mathworks.co.uk/help/matlab/apiref/mxcreatenumericarray.html

will be destroyed. You can create the Matlab array, get a pointer to it,
and then copy over the content of the ITK buffer, but that's as good as you
can do.


>
> As Matt said this behavior that you are expecting is not required, and as
> I mentioned above sometimes not do able. However, based on the code you
> provided, it should be possible to modify this filter to do the correct
> grafting. If you create a patch, which adds to the exiting test for this
> filter this behavior, then submit it to gerrit, it would make it easier for
> someone to modify the filter to the desired behavior.
>
>

I'm happy to do this, but I have no idea where to start.

What I have done is write method to copy ITK filters to Matlab in our
MatlabExportFilter, and share it here

https://code.google.com/p/gerardus/source/browse/trunk/matlab/MatlabExportFilter.h?r=1298#119

Best regards,

Ramon.

-- 
Dr. Ramón Casero Cañas

Oxford e-Research Centre (OeRC)
University of Oxford
7 Keble Rd
Oxford OX1 3QG

tlf     +44 (0) 1865 610739
web     http://www.cs.ox.ac.uk/people/Ramon.CaseroCanas
photos  http://www.flickr.com/photos/rcasero/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130809/8020253d/attachment.htm>


More information about the Insight-users mailing list