int
main(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Usage: " << argv[0] << " inputFile outputFile [percent]" << std::endl;
return EXIT_FAILURE;
}
double percent = .1;
if (argc > 3)
{
percent = std::stod(argv[3]);
if (percent >= 1.0)
{
percent /= 100.0;
}
}
const auto input = itk::ReadImage<ImageType>(argv[1]);
IteratorType it(input, input->GetLargestPossibleRegion());
it.SetNumberOfSamples(input->GetLargestPossibleRegion().GetNumberOfPixels() * percent);
std::cout << "Number of random samples: " << it.GetNumberOfSamples() << std::endl;
it.GoToBegin();
while (!it.IsAtEnd())
{
it.Set(random->GetUniformVariate(0, 255));
++it;
}
return EXIT_SUCCESS;
}