int
main(int argc, char * argv[])
{
if (argc < 5)
{
std::cerr << "Usage: " << argv[0] << " inputImageFile ";
std::cerr << " outputImageFile1 outputImageFile2 outputImageFile3"
<< std::endl;
return EXIT_FAILURE;
}
using PixelType = unsigned char;
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());
filter->SetOutsideValue(0);
filter->ThresholdBelow(180);
filter->Update();
writer->SetFileName(argv[2]);
writer->Update();
filter->ThresholdAbove(180);
filter->Update();
writer->SetFileName(argv[3]);
writer->Update();
filter->ThresholdOutside(170, 190);
filter->Update();
writer->SetFileName(argv[4]);
writer->Update();
return EXIT_SUCCESS;
}