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();
}
catch (const itk::ExceptionObject & excp)
{
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
ImageType::SpacingType spacing = inputImage->GetSpacing();
if (argc > 3)
{
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)
{
double additionalAngle = std::stod(argv[7]);
filter->SetOutputDirection(newDirection);
filter->ChangeDirectionOn();
}
filter->SetInput(reader->GetOutput());
writer->SetInput(filter->GetOutput());
try
{
writer->Update();
}
catch (const itk::ExceptionObject & excp)
{
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}