Arithmetic Exception opening CT Image

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
martinrame
Posts: 329
Joined: Mon, 2009-02-23, 19:57

Arithmetic Exception opening CT Image

#1 Post by martinrame » Fri, 2011-04-29, 15:30

Hi, I'm getting an arithmetic exception trying to open a CT image on a Win32 machine, DCMTK 3.6.0 compiled with Mingw32. On Linux x86_64 with the same code the image can be openned without problems.

The image is opened with

Code: Select all

DicomImage * image = new DicomImage(fileFormat, xfer, CIF_AcrNemaCompatibility, fstart, fcount);
And the exception occurs in dimoipxt.h, line 235:

Here's the content of that line:

Code: Select all

for (i = 0; i < ocnt; ++i)  // calculating LUT entries
   *(q++) = OFstatic_cast(T3, OFstatic_cast(double, i) + absmin + intercept);
At the moment of the exception the values of vars are this:

Code: Select all

absmin = -32768
intercept = -1024
i = 0
ocnt = 65536
I must add that I can open any kind of images but CT.

Hope you can help me find the solution.

Thanks in advance.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier » Fri, 2011-04-29, 19:53

I never had any exception when processing CT images, so I guess that it is caused by your build system / compiler switches. In general, DCMTK does not use exceptions - apart from some internal exceptions in the new modules "oflog" and "dcmjpls".

martinrame
Posts: 329
Joined: Mon, 2009-02-23, 19:57

#3 Post by martinrame » Fri, 2011-04-29, 20:31

Yes, I think the problem is more related to my setup (MingW32) than the CT image or DCMTK. Sadly there aren't many people using this combination.

Regarding the exception, it isn't raised by DCMTK, but from the operating system. Here's more info: http://en.wikipedia.org/wiki/SIGFPE

It seems to be related to a type overflow.

martinrame
Posts: 329
Joined: Mon, 2009-02-23, 19:57

#4 Post by martinrame » Fri, 2011-06-10, 15:46

I found the solution!.

In Delphi, I have to set this:

Code: Select all

Set8087CW($133f);
The code above disables FPU exceptions.

More info here:
http://docs.embarcadero.com/products/ra ... 087CW.html

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest