int main(int argc, char* argv[])
{
if( argc < 3)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImage outputImage " << std::endl;
return EXIT_FAILURE;
}
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
using CharPixelType = unsigned char;
using RealPixelType = double;
RealImageType,
RealImageType >;
RealImageType,
RealImageType>;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
CastToRealFilterType::Pointer toReal = CastToRealFilterType::New();
CastToCharFilterType::Pointer toChar = CastToCharFilterType::New();
RescaleFilter::Pointer rescale = RescaleFilter::New();
LaplacianFilter::Pointer lapFilter = LaplacianFilter::New();
ZeroCrossingFilter::Pointer zeroFilter = ZeroCrossingFilter::New();
reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename );
rescale->SetOutputMinimum( 0 );
rescale->SetOutputMaximum( 255 );
toReal->SetInput( reader->GetOutput() );
toChar->SetInput( rescale->GetOutput() );
writer->SetInput( toChar->GetOutput() );
lapFilter->SetInput( toReal->GetOutput() );
zeroFilter->SetInput( lapFilter->GetOutput() );
rescale->SetInput( zeroFilter->GetOutput() );
try
{
writer->Update();
}
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}