int main(int argc, char * argv[])
{
if( argc < 3 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile" << std::endl;
return EXIT_FAILURE;
}
std::string inputFilename = argv[1];
std::string outputFilename = argv[2];
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( inputFilename );
VectorImageType, UnsignedCharImageType > VectorMagnitudeFilterType;
VectorMagnitudeFilterType::Pointer magnitudeFilter =
VectorMagnitudeFilterType::New();
magnitudeFilter->SetInput( reader->GetOutput() );
UnsignedCharImageType, UnsignedCharImageType > rescaleFilterType;
rescaleFilterType::Pointer rescaler =
rescaleFilterType::New();
rescaler->SetOutputMinimum(0);
rescaler->SetOutputMaximum(255);
rescaler->SetInput( magnitudeFilter->GetOutput() );
WriterType::Pointer writer =
WriterType::New();
writer->SetFileName( outputFilename );
writer->SetInput( rescaler->GetOutput() );
writer->Update();
return EXIT_SUCCESS;
}