int main( int argc, char * argv[] )
{
if( argc < 7 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile ";
std::cerr << "numberOfIterations timeStep stencilRadius threshold" << std::endl;
return EXIT_FAILURE;
}
typedef float InputPixelType;
typedef float OutputPixelType;
InputImageType, OutputImageType > FilterType;
FilterType::Pointer filter = FilterType::New();
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
filter->SetInput( reader->GetOutput() );
const unsigned int numberOfIterations = atoi( argv[3] );
const double timeStep = atof( argv[4] );
typedef FilterType::RadiusValueType RadiusType;
const RadiusType radius = atol( argv[5] );
const double threshold = atof( argv[6] );
filter->SetTimeStep( timeStep );
filter->SetNumberOfIterations( numberOfIterations );
filter->SetStencilRadius( radius );
filter->SetThreshold( threshold );
filter->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( filter->GetOutput() );
writer->SetInput( rescaler->GetOutput() );
writer->Update();
return EXIT_SUCCESS;
}