[Dcmlib] gdcm exception during new gdcm::File()

gbook gbook at gbook.org
Mon May 16 14:04:57 CEST 2005


I'm having some trouble creating a new gdcm::File(filename) object with 
gdcm 1.0. I didn't have this problem with 0.6 though. I try to create a 
File object like this: (filepath = "C:\gdcmData\00191113.dcm")

       dcfile = new gdcm::File(filepath.c_str());

It fails with an unhandled exception error. When I place it inside a 
try/catch statement, it fails gracefully without raising an exception.

   try { dcfile = new gdcm::File(filepath.c_str()); }
   catch (...) {
       logWnd->AppendText(msg.Format("Creating a new gdcm file 
failed...\n"));
       return 0;
   }

But... when I try to catch the error in an exception object, it fails 
with an unhandled exception error:

   try {
       dcfile = new gdcm::File(filepath.c_str());
   }
   catch (gdcm::FileError e) {
//        logWnd->AppendText(msg.Format("Creating a new gdcm file 
failed...(%s)\n", theError.c_str()));
       logWnd->AppendText(msg.Format("Creating a new gdcm file 
failed...\n"));
       return 0;       
   }


So, I have two questions: 1) what is the proper way to catch exceptions 
originating from gdcm function calls. 2) The files I'm using work fine 
with gdcm 0.6, but not with 1.0. Is there a change in the way it reads 
files in 1.0?
I'm using MS Visual C++ on Windows 2000. I'm also using wxWidgets.

Thanks
-Greg Book




More information about the Dcmlib mailing list