int
main(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "Missing arguments" << std::endl;
std::cerr << "Usage: PolyLineParametricPath inputImageFileName"
<< std::endl;
return EXIT_FAILURE;
}
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
try
{
reader->Update();
}
catch (const itk::ExceptionObject & excp)
{
std::cout << "Problem reading the input image " << std::endl;
std::cout << excp << std::endl;
return EXIT_FAILURE;
}
ImageType::ConstPointer image = reader->GetOutput();
PathType::Pointer path = PathType::New();
path->Initialize();
using ContinuousIndexType = PathType::ContinuousIndexType;
ContinuousIndexType cindex;
ImagePointType origin = image->GetOrigin();
ImageType::SpacingType spacing = image->GetSpacing();
ImagePointType point;
point[0] = origin[0] + spacing[0] * size[0];
point[1] = origin[1] + spacing[1] * size[1];
image->TransformPhysicalPointToContinuousIndex(origin, cindex);
path->AddVertex(cindex);
image->TransformPhysicalPointToContinuousIndex(point, cindex);
path->AddVertex(cindex);
return EXIT_SUCCESS;
}