int
main(int argc, char * argv[])
{
if (argc < 6)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << std::endl;
std::cerr << " <InputImage> <OutputImage> <NumberOfBins>";
std::cerr << " <NumberOfThresholds> <LabelOffset>" << std::endl;
return EXIT_FAILURE;
}
using PixelType = unsigned char;
const char * InputImage = argv[1];
const char * OutputImage = argv[2];
const auto NumberOfHistogramBins = static_cast<SizeType>(atoi(argv[3]));
const auto NumberOfThresholds = static_cast<SizeType>(atoi(argv[4]));
const auto LabelOffset = static_cast<PixelType>(atoi(argv[5]));
const auto input = itk::ReadImage<ImageType>(InputImage);
filter->SetInput(input);
filter->SetNumberOfHistogramBins(NumberOfHistogramBins);
filter->SetNumberOfThresholds(NumberOfThresholds);
filter->SetLabelOffset(LabelOffset);
FilterType::ThresholdVectorType thresholds = filter->GetThresholds();
std::cout << "Thresholds:" << std::endl;
for (double threshold : thresholds)
{
std::cout << threshold << std::endl;
}
std::cout << std::endl;
rescaler->SetInput(filter->GetOutput());
rescaler->SetOutputMinimum(0);
rescaler->SetOutputMaximum(255);
try
{
}
catch (
const itk::ExceptionObject &
e)
{
std::cerr <<
"Error: " <<
e << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}