int
main(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile " << std::endl;
return EXIT_FAILURE;
}
using PixelType = unsigned char;
const char * inputFilename = argv[1];
reader->SetFileName(inputFilename);
try
{
reader->Update();
}
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
const ImageType * image = reader->GetOutput();
IteratorType it(image, image->GetBufferedRegion());
unsigned long pointId = 0;
while (!it.IsAtEnd())
{
image->TransformIndexToPhysicalPoint(it.GetIndex(),
point);
pointSet->SetPoint(pointId,
point);
pointSet->SetPointData(pointId, it.Get());
++it;
++pointId;
}
std::cout << "Number Of Points = ";
std::cout << pointSet->GetNumberOfPoints() << std::endl;
return EXIT_SUCCESS;
}