int main( int argc, char * argv[] )
{
if( argc < 4 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile sigma [RescaledOutputImageFile] " << std::endl;
return EXIT_FAILURE;
}
typedef float InputPixelType;
typedef float OutputPixelType;
InputImageType, OutputImageType > FilterType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
FilterType::Pointer laplacian = FilterType::New();
laplacian->SetNormalizeAcrossScale( false );
laplacian->SetInput( reader->GetOutput() );
const double sigma = atof( argv[3] );
laplacian->SetSigma( sigma );
try
{
laplacian->Update();
}
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
typedef float WritePixelType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput( laplacian->GetOutput() );
writer->SetFileName( argv[2] );
writer->Update();
if (argc > 4)
{
typedef unsigned char CharPixelType;
RescaleFilterType;
RescaleFilterType::Pointer rescale = RescaleFilterType::New();
rescale->SetInput( laplacian->GetOutput() );
rescale->SetOutputMinimum( 0 );
rescale->SetOutputMaximum( 255 );
CharWriterType::Pointer charWriter = CharWriterType::New();
charWriter->SetFileName( argv[4] );
charWriter->SetInput( rescale->GetOutput() );
charWriter->Update();
}
return EXIT_SUCCESS;
}