int
main(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile";
std::cerr << " [exampleAction={0,1,2,3}]" << std::endl;
return EXIT_FAILURE;
}
int exampleAction = 0;
if (argc >= 4)
{
exampleAction = std::stoi(argv[3]);
}
using InputPixelType = unsigned char;
using OutputPixelType = unsigned char;
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
using FilterType =
filter->SetTransform(transform);
using InterpolatorType =
filter->SetInterpolator(interpolator);
filter->SetDefaultPixelValue(0);
const double spacing[
Dimension] = { 1.0, 1.0 };
filter->SetOutputSpacing(spacing);
const double origin[
Dimension] = { 0.0, 0.0 };
filter->SetOutputOrigin(origin);
filter->SetOutputDirection(direction);
size[0] = 300;
size[1] = 300;
filter->SetInput(reader->GetOutput());
writer->SetInput(filter->GetOutput());
writer->Update();
TransformType::OutputVectorType translation;
translation[0] = -30;
translation[1] = -50;
transform->Translate(translation);
if (exampleAction == 1)
{
writer->Update();
}
filter->SetDefaultPixelValue(100);
if (exampleAction == 2)
{
writer->Update();
}
return EXIT_SUCCESS;
}