int main( int argc, char * argv[] )
{
if( argc < 5 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile domainSigma rangeSigma" << std::endl;
return EXIT_FAILURE;
}
typedef unsigned char InputPixelType;
typedef unsigned char 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 Dimension = InputImageType::ImageDimension;
double domainSigmas[ Dimension ];
for(unsigned int i=0; i<Dimension; i++)
{
domainSigmas[i] = atof( argv[3] );
}
const double rangeSigma = atof( argv[4] );
filter->SetDomainSigma( domainSigmas );
filter->SetRangeSigma( rangeSigma );
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;
}