int main( int argc, char * argv[] )
{
if( argc < 7 )
{
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImageFile outputImageFile ";
std::cerr << " lowerThreshold upperThreshold ";
std::cerr << " outsideValue insideValue " << std::endl;
return EXIT_FAILURE;
}
typedef unsigned char InputPixelType;
typedef unsigned char OutputPixelType;
InputImageType, OutputImageType > FilterType;
ReaderType::Pointer reader = ReaderType::New();
FilterType::Pointer filter = FilterType::New();
WriterType::Pointer writer = WriterType::New();
writer->SetInput( filter->GetOutput() );
reader->SetFileName( argv[1] );
filter->SetInput( reader->GetOutput() );
const OutputPixelType outsideValue = atoi( argv[5] );
const OutputPixelType insideValue = atoi( argv[6] );
filter->SetOutsideValue( outsideValue );
filter->SetInsideValue( insideValue );
const InputPixelType lowerThreshold = atoi( argv[3] );
const InputPixelType upperThreshold = atoi( argv[4] );
filter->SetLowerThreshold( lowerThreshold );
filter->SetUpperThreshold( upperThreshold );
filter->Update();
writer->SetFileName( argv[2] );
writer->Update();
return EXIT_SUCCESS;
}