int
main(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Missing parameters. " << std::endl;
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile" << std::endl;
return EXIT_FAILURE;
}
try
{
inputImage = itk::ReadImage<ImageType>(argv[1]);
}
catch (const itk::ExceptionObject & err)
{
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
return EXIT_FAILURE;
}
outputImage->SetRegions(inputImage->GetRequestedRegion());
outputImage->CopyInformation(inputImage);
outputImage->Allocate();
IteratorType outputIt(outputImage, outputImage->GetRequestedRegion());
outputImage->GetRequestedRegion().
GetIndex();
outputImage->GetRequestedRegion().
GetSize();
for (outputIt.GoToBegin(); !outputIt.IsAtEnd(); ++outputIt)
{
idx[0] = requestedIndex[0] + requestedSize[0] - 1 - idx[0];
outputIt.Set(inputImage->GetPixel(idx));
}
try
{
}
catch (const itk::ExceptionObject & err)
{
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}