int
main(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile" << std::endl;
std::cerr << " [scalingFactor] [translationX translationY translationZ]"
<< std::endl;
std::cerr << " [rotationZinDegrees]" << std::endl;
return EXIT_FAILURE;
}
using PixelType = unsigned char;
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
try
{
reader->Update();
}
{
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
ImageType::SpacingType spacing = inputImage->GetSpacing();
if (argc > 3)
{
const double scale = std::stod(argv[3]);
{
spacing[i] *= scale;
}
filter->SetOutputSpacing(spacing);
filter->ChangeSpacingOn();
}
if (argc > 6)
{
translation[0] = std::stod(argv[4]);
translation[1] = std::stod(argv[5]);
translation[2] = std::stod(argv[6]);
origin += translation;
filter->SetOutputOrigin(origin);
filter->ChangeOriginOn();
}
if (argc > 7)
{
const double additionalAngle = std::stod(argv[7]);
const double angleInRadians = additionalAngle *
itk::Math::pi / 180.0;
filter->SetOutputDirection(newDirection);
filter->ChangeDirectionOn();
}
filter->SetInput(reader->GetOutput());
writer->SetInput(filter->GetOutput());
try
{
writer->Update();
}
{
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}