int
main(int argc, char ** argv)
{
if (argc < 5)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << "directory regularExression ";
std::cerr << "sortingExpression outputImageFile " << std::endl;
return EXIT_FAILURE;
}
using PixelType = unsigned char;
std::string directory = argv[1];
std::string regularExpression = argv[2];
const unsigned int subMatch = std::stoi(argv[3]);
std::string outputFilename = argv[4];
nameGenerator->SetRegularExpression(regularExpression);
nameGenerator->SetSubMatch(subMatch);
nameGenerator->SetDirectory(directory);
reader->SetFileNames(nameGenerator->GetFileNames());
writer->SetFileName(outputFilename);
writer->SetInput(reader->GetOutput());
try
{
writer->Update();
}
catch (const itk::ExceptionObject & err)
{
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}