AccessViolationException | Convert DICOMImage to Image

188 views
Skip to first unread message

Helder Pinhal

unread,
Dec 16, 2014, 9:08:57 AM12/16/14
to fo-d...@googlegroups.com
Good morning everyone,

I know things are a bit stopped around here, but I am hoping to get some help / guidance in this difficult task.

I have this weird exception going on... I am loading a couple of images (.dcm) from disk and render them in picture boxes.
Code to achieve this:
var image = (new DicomImage(storedImage.Path)).RenderImage();

I've been going mad with this thing for two days now.

It seems the image is just too big to be drawn...
Because it works perfectly when I make a 500x500 thumbnail and display it instead of the original image.

Hoping to hear from you,
Helder Pinhal

Ian Yates

unread,
Dec 17, 2014, 7:22:29 PM12/17/14
to fo-d...@googlegroups.com
A couple of thoughts...

a) How big is this image?  (Pixels & bytes)
b) If you render to an image and then save that image as a JPEG to disk do you still get problems?
c) Are you able to share the source image?  If not, could you share if you ran it through some DICOM anonymisation first?
d) In your WinForms code, if you do everything except showing the image, do you still get your AV exception?  For example, if you do your new DicomImage(...) call, but then give the GUI some random JPEG to display instead, does it still crash?

I'm trying to see if we can at least isolate the problem to a definite area.  It could be that the pixel data being generated by fo-DICOM after decompression is overlapping some other memory.  It could be something else in the GUI stack after that.

Helder Pinhal

unread,
Jan 6, 2015, 6:19:00 AM1/6/15
to fo-d...@googlegroups.com
Later I found out it was a problem of .NET itself.
I was using an IMAGE which setter uses a pointer instead of a copy.
When disposing it, since it was still in use somewhere else, I got that exception.

Thank you.

Ian Yates

unread,
Jan 6, 2015, 8:31:12 AM1/6/15
to fo-d...@googlegroups.com
Good to know - thanks for replying :)

Chris Horn

unread,
Jan 8, 2015, 7:17:24 AM1/8/15
to fo-d...@googlegroups.com

Ian Yates

unread,
Jan 8, 2015, 6:01:41 PM1/8/15
to fo-d...@googlegroups.com
Thanks Chris :)
Reply all
Reply to author
Forward
0 new messages