ITK
4.12.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
WikiExamples/SimpleOperations/TryCatch.cxx
#include "
itkSize.h
"
#include "
itkImage.h
"
#include "
itkImageFileReader.h
"
int
main(
int
,
char
*[])
{
typedef
itk::Image< double, 2 >
ImageType;
typedef
itk::ImageFileReader<ImageType>
ReaderType;
try
{
ReaderType::Pointer
reader =
ReaderType::New
();
reader->SetFileName(
"nofile.png"
);
reader->Update();
}
catch
(
itk::ExceptionObject
& err )
{
std::cerr <<
"ExceptionObject caught !"
<< std::endl;
std::cerr << err << std::endl;
return
EXIT_SUCCESS;
// Since the goal of the example is to catch the exception, we declare this a success.
}
return
EXIT_FAILURE;
// Since the goal of the example is to catch the exception, the example fails if it is not caught.
}
Generated on Tue May 30 2017 03:00:54 for ITK by
1.8.5