int
main(int argc, char * argv[])
{
if (argc < 5)
{
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImageFile outputImageFile ";
std::cerr << " insideValue outsideValue " << std::endl;
return EXIT_FAILURE;
}
using InputPixelType = unsigned char;
using OutputPixelType = unsigned char;
using FilterType =
writer->SetInput(filter->GetOutput());
reader->SetFileName(argv[1]);
filter->SetInput(reader->GetOutput());
const OutputPixelType outsideValue = std::stoi(argv[3]);
const OutputPixelType insideValue = std::stoi(argv[4]);
filter->SetOutsideValue(outsideValue);
filter->SetInsideValue(insideValue);
try
{
filter->Update();
}
{
std::cerr << "Exception thrown " << excp << std::endl;
}
const int threshold = filter->GetThreshold();
std::cout << "Threshold = " << threshold << std::endl;
writer->SetFileName(argv[2]);
try
{
writer->Update();
}
{
std::cerr << "Exception thrown " << excp << std::endl;
}
return EXIT_SUCCESS;
}