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;
}
using InputPixelType = float;
using OutputPixelType = float;
InputImageType, OutputImageType >;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
FilterType::Pointer laplacian = FilterType::New();
laplacian->SetNormalizeAcrossScale( false );
laplacian->SetInput( reader->GetOutput() );
const double sigma = std::stod( argv[3] );
laplacian->SetSigma( sigma );
try
{
laplacian->Update();
}
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
using WritePixelType = float;
WriterType::Pointer writer = WriterType::New();
writer->SetInput( laplacian->GetOutput() );
writer->SetFileName( argv[2] );
writer->Update();
if (argc > 4)
{
using CharPixelType = unsigned char;
using 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;
}