int main( int argc, char * argv[] )
{
if( argc < 4 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile sigma " << 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 filterX = FilterType::New();
FilterType::Pointer filterY = FilterType::New();
filterX->SetDirection( 0 );
filterY->SetDirection( 1 );
filterX->SetOrder( FilterType::ZeroOrder );
filterY->SetOrder( FilterType::ZeroOrder );
filterX->SetNormalizeAcrossScale( false );
filterY->SetNormalizeAcrossScale( false );
filterX->SetInput( reader->GetOutput() );
filterY->SetInput( filterX->GetOutput() );
const double sigma = atof( argv[3] );
filterX->SetSigma( sigma );
filterY->SetSigma( sigma );
filterY->Update();
typedef unsigned char WritePixelType;
OutputImageType, WriteImageType > RescaleFilterType;
RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
rescaler->SetOutputMinimum( 0 );
rescaler->SetOutputMaximum( 255 );
WriterType::Pointer writer = WriterType::New();
writer->SetFileName( argv[2] );
rescaler->SetInput( filterY->GetOutput() );
writer->SetInput( rescaler->GetOutput() );
writer->Update();
return EXIT_SUCCESS;
}