int
main(int argc, char * argv[])
{
if (argc != 3)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0];
std::cerr << " <InputFileName> <OutputFileName>";
std::cerr << std::endl;
return EXIT_FAILURE;
}
const char * inputFileName = argv[1];
const char * outputFileName = argv[2];
std::string format = std::string(outputFileName) + std::string("-%d.png");
using PixelType = unsigned char;
const auto input = itk::ReadImage<InputImageType>(inputFileName);
using OutputPixelType = unsigned char;
rescale->SetInput(input);
rescale->SetOutputMinimum(0);
rescale->SetOutputMaximum(255);
rescale->UpdateLargestPossibleRegion();
fnames->SetStartIndex(0);
fnames->SetEndIndex(size[2] - 1);
fnames->SetIncrementIndex(1);
fnames->SetSeriesFormat(format.c_str());
writer->SetInput(rescale->GetOutput());
writer->SetFileNames(fnames->GetFileNames());
try
{
writer->Update();
}
catch (const itk::ExceptionObject & error)
{
std::cerr << "Error: " << error << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}