[Insight-developers] (no subject)

Brad King brad.king@kitware.com
Wed, 1 Aug 2001 15:56:46 -0400 (EDT)


> typedef itk::Mesh<double>  Mesh;
[snip]
> My questions is, how do i template the mesh to be using itk::Point<double>?

The first template parameter to Mesh is the "PixelType", which is the type
of data stored at a point.  What you want to change is the "PointType",
which is the respresentation used to store a point in space (a vertex of
the mesh).  More specifically, you want to change the coordinate
representation used by the point type.  The MeshTraits template argument
(the third argument) controls the coordinate representation type.  The
DefaultStaticMeshTraits class provides an easy way to change this while
keeping everything else the same:

typedef double MyPixelType;
typedef double MyCoordRepType;
typedef itk::DefaultStaticMeshTraits<MyPixelType, 3, 3, MyCoordRepType>
        MyMeshTraits;
typedef itk::Mesh<MyPixelType, 3, MyMeshTraits> Mesh;

You could also do this in a single typedef:
typedef itk::Mesh<double, 3,
                  itk::DefaultStaticMeshTraits<double, 3, 3, double> > Mesh;

Now you should be able to use itk::Point<double> with the mesh.  However,
it is probably better to ask the Mesh for its point type:

typedef typename Mesh::PointType MeshPointType;

This way, it is guaranteed that your point matches the Mesh's point type.

-Brad