[Insight-users] Requesting ITK image from C#

wail ba-alawi ba3lwi at gmail.com
Fri Jun 19 10:49:56 EDT 2009


Hi all,

I have a windows form app in C# as my interface and I have some methods
written in C++ dll using the ITK library

what I did is to create a function(ReadImage) that reads an image and return
it as:
itk::ImageSource<itk::Image<unsigned short,2>>::OutputImageType* obj;
obj = static_cast<itk::Image<unsigned short,2>*>(reader->GetOutput());
return obj;

and another function(WriteImage) in the same dll will take that output as an
Input to to an ITK writer

when I call the (WriteImage) function in the (ReadImage) within the dll
everything goes perfectly
but when I do the following I get memory violation:
I call the (ReadImage) from C# and assign the output to Intptr
then I call the (WriteImage) from C# and insert the Intptr as an Input
the second call gives always a memory violation error

any idea of what can I do?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090619/380aa3f7/attachment.htm>


More information about the Insight-users mailing list