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;
}
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;
}
path->Initialize();
using ContinuousIndexType = PathType::ContinuousIndexType;
ContinuousIndexType cindex;
ImagePointType origin = image->GetOrigin();
ImageType::SpacingType spacing = image->GetSpacing();
point[0] = origin[0] + spacing[0] * size[0];
point[1] = origin[1] + spacing[1] * size[1];
using ContinuousIndexValueType = ContinuousIndexType::ValueType;
cindex =
image->TransformPhysicalPointToContinuousIndex<ContinuousIndexValueType>(
origin);
path->AddVertex(cindex);
cindex =
image->TransformPhysicalPointToContinuousIndex<ContinuousIndexValueType>(
path->AddVertex(cindex);
return EXIT_SUCCESS;
}