40 #ifndef ITK_STANDARD_MESH_REPRESENTER_H
41 #define ITK_STANDARD_MESH_REPRESENTER_H
43 #include <boost/unordered_map.hpp>
46 #include <itkObject.h>
48 #include "statismoITKConfig.h"
50 #include "CommonTypes.h"
51 #include "Exceptions.h"
52 #include "Representer.h"
54 #include "itkPixelConversionTraits.h"
58 struct RepresenterTraits<itk::Mesh<float, 3u> > {
60 typedef itk::Mesh<float, 3u> MeshType;
62 typedef MeshType::Pointer DatasetPointerType;
63 typedef MeshType::Pointer DatasetConstPointerType;
65 typedef MeshType::PointType PointType;
66 typedef MeshType::PointType ValueType;
74 template <
typename Po
intType>
75 size_t hash_value(
const PointType& pt) {
77 for (
unsigned i = 0; i < pt.GetPointDimension(); i++) {
78 boost::hash_combine( hash_val, pt[i] );
89 template <
class TPixel,
unsigned MeshDimension>
95 typedef Object Superclass;
96 typedef SmartPointer<Self> Pointer;
97 typedef SmartPointer<const Self> ConstPointer;
100 typedef itk::Mesh<TPixel, MeshDimension> MeshType;
101 typedef typename statismo::Representer<MeshType > RepresenterBaseType;
103 typedef typename RepresenterBaseType::PointType PointType;
104 typedef typename RepresenterBaseType::ValueType ValueType;
105 typedef typename RepresenterBaseType::DatasetPointerType DatasetPointerType;
106 typedef typename RepresenterBaseType::DatasetConstPointerType DatasetConstPointerType;
107 typedef typename MeshType::PointsContainer PointsContainerType;
120 void Load(
const H5::Group& fg);
127 typedef boost::unordered_map<PointType, unsigned> PointCacheType;
132 unsigned GetDimensions()
const {
133 return MeshDimension;
135 std::string GetName()
const {
136 return "itkStandardMeshRepresenter";
138 typename RepresenterBaseType::RepresenterDataType GetType()
const {
139 return RepresenterBaseType::POLYGON_MESH;
141 std::string GetVersion()
const {
152 statismo::VectorType PointToVector(
const PointType& pt)
const;
188 void Save(
const H5::Group& fg)
const;
202 void Delete()
const {
207 void DeleteDataset(DatasetPointerType d)
const { };
208 DatasetPointerType CloneDataset(DatasetConstPointerType mesh)
const;
212 typename MeshType::Pointer LoadRef(
const H5::Group& fg)
const;
213 typename MeshType::Pointer LoadRefLegacy(
const H5::Group& fg)
const;
216 unsigned FindClosestPoint(
const MeshType* mesh,
const PointType pt)
const ;
218 DatasetConstPointerType m_reference;
220 mutable PointCacheType m_pointCache;
228 #include "itkStandardMeshRepresenter.hxx"
MeshType DatasetType
The type of the data set to be used.
Definition: itkStandardMeshRepresenter.h:124
statismo::VectorType SampleToSampleVector(DatasetConstPointerType sample) const
Definition: itkStandardMeshRepresenter.hxx:235
A representer for scalar valued itk Meshs.
Definition: itkStandardMeshRepresenter.h:90
ValueType PointSampleFromSample(DatasetConstPointerType sample, unsigned ptid) const
Definition: itkStandardMeshRepresenter.hxx:279
virtual unsigned GetPointIdForPoint(const PointType &point) const
Definition: itkStandardMeshRepresenter.hxx:374
statismo::VectorType PointSampleToPointSampleVector(const ValueType &v) const
Definition: itkStandardMeshRepresenter.hxx:299
void Save(const H5::Group &fg) const
Definition: itkStandardMeshRepresenter.hxx:310
DatasetPointerType SampleVectorToSample(const statismo::VectorType &sample) const
Definition: itkStandardMeshRepresenter.hxx:257
DatasetConstPointerType GetReference() const
return the reference used in the representer
Definition: itkStandardMeshRepresenter.h:198
itkTypeMacro(StandardMeshRepresenter, Object)
void SetReference(DatasetPointerType ds)
Definition: itkStandardMeshRepresenter.hxx:194
ValueType PointSampleVectorToPointSample(const statismo::VectorType &pointSample) const
Definition: itkStandardMeshRepresenter.hxx:290
DatasetPointerType DatasetToSample(DatasetConstPointerType ds) const
Definition: itkStandardMeshRepresenter.hxx:228
virtual unsigned GetNumberOfPoints() const
return the number of points of the reference
Definition: itkStandardMeshRepresenter.hxx:367