int
main(int argc, char * argv[])
{
if (argc != 4)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0];
std::cerr << " <InputFileName> <OutputFileName> <DefaultPixelValue>";
std::cerr << std::endl;
return EXIT_FAILURE;
}
using ScalarType = double;
const char * inputFileName = argv[1];
const char * outputFileName = argv[2];
const auto defaultValue = static_cast<ScalarType>(std::stod(argv[3]));
MatrixType matrix;
matrix[0][0] = std::cos(0.05);
matrix[0][1] = std::sin(0.05);
matrix[0][2] = 0.;
matrix[1][0] = -matrix[0][1];
matrix[1][1] = matrix[0][0];
matrix[1][2] = 0.;
matrix[2][0] = -10.;
matrix[2][1] = -20.;
matrix[2][2] = 1.;
using PixelType = unsigned char;
const auto input = itk::ReadImage<ImageType>(inputFileName);
ResampleImageFilterType::Pointer resample = ResampleImageFilterType::New();
resample->SetInput(input);
resample->SetReferenceImage(input);
resample->UseReferenceImageOn();
resample->SetSize(size);
resample->SetDefaultPixelValue(defaultValue);
constexpr unsigned int Radius = 3;
InterpolatorType::Pointer interpolator = InterpolatorType::New();
resample->SetInterpolator(interpolator);
TransformType::Pointer transform = TransformType::New();
{
{
parameters[i *
Dimension + j] = matrix[i][j];
}
}
{
}
transform->SetParameters(parameters);
resample->SetTransform(transform);
try
{
}
catch (itk::ExceptionObject & error)
{
std::cerr << "Error: " << error << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}