int
main(int argc, char ** argv)
{
if (argc < 4)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << "first last outputRGBImageFile " << std::endl;
return EXIT_FAILURE;
}
const unsigned int first = std::stoi(argv[1]);
const unsigned int last = std::stoi(argv[2]);
const char * outputFilename = argv[3];
nameGenerator->SetStartIndex(first);
nameGenerator->SetEndIndex(last);
nameGenerator->SetIncrementIndex(1);
nameGenerator->SetSeriesFormat("vwe%03d.png");
seriesReader->SetFileNames(nameGenerator->GetFileNames());
writer->SetFileName(outputFilename);
writer->SetInput(seriesReader->GetOutput());
try
{
writer->Update();
}
catch (const itk::ExceptionObject & excp)
{
std::cerr << "Error reading the series " << std::endl;
std::cerr << excp << std::endl;
}
seriesWriter->SetInput(seriesReader->GetOutput());
nameGenerator->SetSeriesFormat("output%03d.png");
seriesWriter->SetFileNames(nameGenerator->GetFileNames());
try
{
seriesWriter->Update();
}
catch (const itk::ExceptionObject & excp)
{
std::cerr << "Error reading the series " << std::endl;
std::cerr << excp << std::endl;
}
return EXIT_SUCCESS;
}