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());
it.GoToBegin();
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;
}
Standard exception handling object.
Data source that reads image data from a single file.
Templated n-dimensional image class.
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
constexpr unsigned int Dimension
ImageBaseType::PointType PointType
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents