38 #ifndef VTKSTANDARDIMAGERESENTER_H_
39 #define VTKSTANDARDIMAGERESENTER_H_
43 #include <vtkSmartPointer.h>
44 #include <vtkStructuredPoints.h>
46 #include "CommonTypes.h"
48 #include "Representer.h"
49 #include "vtkHelper.h"
66 struct RepresenterTraits<vtkStructuredPoints> {
67 typedef vtkStructuredPoints* DatasetPointerType;
68 typedef const vtkStructuredPoints* DatasetConstPointerType;
70 typedef vtkPoint PointType;
71 typedef vtkNDPixel ValueType;
79 template <
class TScalar,
unsigned PixelDimensions>
80 class vtkStandardImageRepresenter :
public Representer<vtkStructuredPoints> {
85 static vtkStandardImageRepresenter* Create(
const vtkStructuredPoints* reference) {
86 return new vtkStandardImageRepresenter(reference);
88 static vtkStandardImageRepresenter* Create() {
89 return new vtkStandardImageRepresenter();
92 void Load(
const H5::Group& fg);
93 vtkStandardImageRepresenter* Clone()
const;
95 virtual ~vtkStandardImageRepresenter();
100 void DeleteDataset(DatasetPointerType d)
const {
104 DatasetPointerType CloneDataset(DatasetConstPointerType d)
const {
105 vtkStructuredPoints* clone = vtkStructuredPoints::New();
106 clone->DeepCopy(const_cast<vtkStructuredPoints*>(d));
111 unsigned GetDimensions()
const {
112 return PixelDimensions;
114 std::string GetVersion()
const {
117 RepresenterDataType GetType()
const {
124 std::string GetName()
const {
125 return "vtkStandardImageRepresenter";
128 const vtkStructuredPoints* GetReference()
const {
132 statismo::VectorType PointToVector(
const PointType& pt)
const;
133 DatasetPointerType DatasetToSample(DatasetConstPointerType ds)
const;
134 statismo::VectorType SampleToSampleVector(DatasetConstPointerType sample)
const;
135 DatasetPointerType SampleVectorToSample(
const statismo::VectorType& sample)
const;
138 ValueType PointSampleFromSample(DatasetConstPointerType sample,
unsigned ptid)
const;
139 statismo::VectorType PointSampleToPointSampleVector(
const ValueType& v)
const;
140 ValueType PointSampleVectorToPointSample(
const statismo::VectorType& samplePoint)
const;
142 unsigned GetPointIdForPoint(
const PointType& pt)
const;
144 unsigned GetNumberOfPoints()
const;
145 void Save(
const H5::Group& fg)
const;
147 static unsigned GetNumberOfPoints(DatasetPointerType reference);
152 vtkStructuredPoints* LoadRefLegacy(
const H5::Group& fg)
const;
153 vtkStructuredPoints* LoadRef(
const H5::Group& fg)
const;
155 vtkStandardImageRepresenter(DatasetConstPointerType reference);
156 vtkStandardImageRepresenter() : m_reference(0) {}
157 void SetReference(DatasetConstPointerType reference);
159 vtkStructuredPoints* m_reference;
165 #include "vtkStandardImageRepresenter.hxx"