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

Jean-Pierre ROUX jean-pierre.roux at creatis.insa-lyon.fr
Mon May 16 16:23:44 CEST 2005


At 15:21 +0200 16/05/05, Benoit Regrain wrote:
>Hi,
>
>I will let others answer concerning the use of exceptions.
>But on this point, I think it's some tests or examples (but it's to
>verify).
>
>Concerning the creation of your gdcm::File :
>- If the file doesn't exist (like I have understand in your mail), 
>it's identic to create an empty gdcm::File by
>        dcfile = new gdcm::File();
>- If your file exists, there's anormal that it's now not readable and
>  generate an exception. In this case, please send the image to
>  JPR (our guru of Dicom files) at : jean-pierre.roux at creatis.insa-lyon.fr


Well...
Actually, we made some modifications in the gdcm class diagram, 
between version 0.6 and 1.0
Could you have a look , in http://www/creatis.univ-lyon1.fr/Public/Gdcm
at 'News', to be sure you didn't miss anything, around gdcm::Document 
/ gdcm::File / gdcm::FileHelper.

JPRx

>
>Cheers
>Benoit Regrain
>
>
>----- Original Message ----- From: "gbook" <gbook at gbook.org>
>To: <dcmlib at creatis.insa-lyon.fr>
>Sent: Monday, May 16, 2005 2:04 PM
>Subject: [Dcmlib] gdcm exception during new gdcm::File()
>
>
>>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
>>
>>_______________________________________________
>>Dcmlib mailing list
>>Dcmlib at creatis.insa-lyon.fr
>>http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib
>_______________________________________________
>Dcmlib mailing list
>Dcmlib at creatis.insa-lyon.fr
>http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib

   Jean-Pierre ROUX
   CREATIS - CNRS UMR 5515, INSERM U 630
   Laboratoire de Radiologie Experimentale
   Hopital Cardiologique
   28 Avenue du Doyen LEPINE
   B.P. Lyon-Montchat
   69394 Lyon Cedex 03
 
   Tel      : (+33) 04 72 35 74 12
   Fax      : (+33) 04 72 68 49 16
   URL      : http://www.creatis.univ-lyon1.fr
   e-mail   : jpr at creatis.univ-lyon1.fr
								   



More information about the Dcmlib mailing list