int
main(int argc, char * argv[])
{
if (argc < 7)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile";
std::cerr << " direction cosines" << std::endl;
return EXIT_FAILURE;
}
using InputPixelType = unsigned char;
using OutputPixelType = unsigned char;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
FilterType::Pointer filter = FilterType::New();
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);
}
direction(0, 0) = std::stoi(argv[3]);
direction(1, 0) = std::stoi(argv[4]);
direction(0, 1) = std::stoi(argv[5]);
direction(1, 1) = std::stoi(argv[6]);
filter->SetOutputDirection(direction);
size[0] = 300;
size[1] = 300;
filter->SetInput(reader->GetOutput());
writer->SetInput(filter->GetOutput());
writer->Update();
return EXIT_SUCCESS;
}