int
main(int argc, char ** argv)
{
if (argc < 4)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0]
<< " firstSliceValue lastSliceValue outputImageFile "
<< std::endl;
return EXIT_FAILURE;
}
using PixelType = unsigned char;
const unsigned int first = std::stoi(argv[1]);
const unsigned int last = std::stoi(argv[2]);
const char * outputFilename = argv[3];
nameGenerator->SetSeriesFormat("vwe%03d.png");
nameGenerator->SetStartIndex(first);
nameGenerator->SetEndIndex(last);
nameGenerator->SetIncrementIndex(1);
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;
}