int
main(int argc, char * argv[])
{
if (argc < 4)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0]
<< " inputImageFile outputImageFile "
"desiredPositiveCoordinateOrientation"
<< std::endl;
return EXIT_FAILURE;
}
const std::string inputImageFile = argv[1];
const std::string outputImageFile = argv[2];
};
if (desiredCoordinateOrientation ==
{
std::cerr << "Invalid desiredPositiveCoordinateOrientation: " << argv[3]
<< std::endl;
std::cerr << "Valid values are of the form LPS, RIP, etc.";
std::cerr << "Where each letter is either L or R, P or A, I or S."
<< std::endl;
return EXIT_FAILURE;
}
using PixelType = unsigned short;
reader->SetFileName(inputImageFile);
reader->UpdateOutputInformation();
auto pixelType = reader->GetImageIO()->GetPixelType();
auto componentType = reader->GetImageIO()->GetComponentType();
{
itkGenericOutputMacro(
"The input image is being converted to scalar unsigned short.");
}
auto inputDirection = reader->GetOutput()->GetDirection();
std::cout << "Input image direction: " << std::endl;
std::cout << "The input image has the following orientation: " << std::endl;
<< std::endl;
std::cout << "The re-orienting to approximately the desired orientation: "
<< std::endl;
std::cout << '\t' << desiredCoordinateOrientation << std::endl;
orienter->SetInput(reader->GetOutput());
orienter->UseImageDirectionOn();
orienter->SetDesiredCoordinateOrientation(desiredCoordinateOrientation);
writer->SetFileName(outputImageFile);
writer->SetInput(orienter->GetOutput());
writer->Update();
return EXIT_SUCCESS;
}
Representations of anatomical orientations and methods to convert between conventions.
static AnatomicalOrientation CreateFromPositiveStringEncoding(std::string str)
Data source that reads image data from a single file.
Writes image data to a single file.
Templated n-dimensional image class.
Control indentation during Print() invocation.
Permute axes and then flip images as needed to obtain agreement in coordinateOrientation codes.