int main( int argc, char * argv[] )
{
if( argc < 5 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile variance maxerror" << std::endl;
return EXIT_FAILURE;
}
typedef double InputPixelType;
typedef double OutputPixelType;
typedef unsigned char CharPixelType;
const unsigned int Dimension = 2;
RescaleFilterType;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
reader->SetFileName( argv[1] );
writer->SetFileName( argv[2] );
FilterType::Pointer filter = FilterType::New();
filter->SetVariance( atof( argv[3] ) );
filter->SetMaximumError( atof( argv[4] ) );
filter->SetInput( reader->GetOutput() );
rescaler->SetInput( filter->GetOutput() );
writer->SetInput( rescaler->GetOutput() );
rescaler->SetOutputMinimum( 0 );
rescaler->SetOutputMaximum( 255 );
try
{
writer->Update();
}
{
std::cerr << excp << std::endl;
}
return EXIT_SUCCESS;
}