Create a PointSet#


Create a PointSet



#include "itkPoint.h"
#include "itkPointSet.h"

  using PixelType = float;
  constexpr unsigned int Dimension = 3;

  using PointSetType = itk::PointSet<PixelType, Dimension>;
  auto PointSet = PointSetType::New();

  using PointsContainerPointer = PointSetType::PointsContainerPointer;
  PointsContainerPointer points = PointSet->GetPoints();

  // Create points
  using PointType = PointSetType::PointType;
  PointType p0, p1, p2;

  p0[0] = 0.0;
  p0[1] = 0.0;
  p0[2] = 0.0;
  p1[0] = 0.1;
  p1[1] = 0.0;
  p1[2] = 0.0;
  p2[0] = 0.0;
  p2[1] = 0.1;
  p2[2] = 0.0;

  points->InsertElement(0, p0);
  points->InsertElement(1, p1);
  points->InsertElement(2, p2);

  return EXIT_SUCCESS;


#!/usr/bin/env python

import itk

PixelType = itk.F
Dimension = 3

PointSetType = itk.PointSet[PixelType, Dimension]
PointSet = PointSetType.New()

points = PointSet.GetPoints()

# Create points
p0 = itk.Point[PixelType, Dimension]()
p1 = itk.Point[PixelType, Dimension]()
p2 = itk.Point[PixelType, Dimension]()

p0[0] = 0.0
p0[1] = 0.0
p0[2] = 0.0
p1[0] = 0.1
p1[1] = 0.0
p1[2] = 0.0
p2[0] = 0.0
p2[1] = 0.1
p2[2] = 0.0

points.InsertElement(0, p0)
points.InsertElement(1, p1)
points.InsertElement(2, p2)

Classes demonstrated#

template<typename TPixelType, unsigned int VDimension = 3, typename TMeshTraits = DefaultStaticMeshTraits<TPixelType, VDimension, VDimension>>
class PointSet : public itk::DataObject

A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute) definition.

PointSet is a superclass of the N-dimensional mesh structure (itk::Mesh). It provides the portion of the mesh definition for geometric coordinates (and associated attribute or pixel information). The defined API provides operations on points but does not tie down the underlying implementation and storage. A “MeshTraits” structure is used to define the container and identifier to access the points. See DefaultStaticMeshTraits for the set of type definitions needed. All types that are defined in the “MeshTraits” structure will have duplicate type alias in the resulting mesh itself.

PointSet has two template parameters. The first is the pixel type, or the type of data stored (optionally) with the points. The second is the “MeshTraits” structure controlling type information characterizing the point set. Most users will be happy with the defaults, and will not have to worry about this second argument.

Template parameters for PointSet:

TPixelType = The type stored as data for the point.

TMeshTraits = Type information structure for the point set.

ITK Sphinx Examples:

Subclassed by itk::Mesh< TPixelType, VDimension, TMeshTraits >

See itk::PointSet for additional documentation.