[Insight-users] debugging

Luis Ibanez luis.ibanez at kitware.com
Mon, 12 Jan 2004 11:57:39 -0500


Hi David,

It is likely that the reader is throwing an
Exception during the execution of the Update()
call.

Please add a try/catch block around the Update().

It will look something like:

    try
      {
      reader->Update();
      }
    catch( itk::ExceptionObject & excp )
      {
      std::cerr << excp << std::endl;
      exit(1);
      }

The message printed out from the exception object
will probably give you an idea of what's going
wrong with the reader.  The most common cause is
to be providing an incorrect filename or trying
to read a fileformat that is not supported in ITK.


You will find multiple examples on the use of
Exceptions in the ITK SoftwareGuide

    htt://www.itk.org/ItkSoftwareGuide.pdf

Please look at Chapter 7, pdf-page 219.



Regards,


    Luis



----------------
David Llanos wrote:

> hi all,
>  
> I have made an application that compiles perfectly, but when i made a 
> debugging step by step, it gives me errors when reading an image in the 
> line:
>  
>                 reader->Update();
>  
> and I can not purify the program...
>  
> Do you know whats the matter?
>  
> Thanks in advange.