20 #ifndef MIRTK_PiecewiseLinearMap_H 21 #define MIRTK_PiecewiseLinearMap_H 23 #include "mirtk/Mapping.h" 24 #include "mirtk/Point.h" 26 #include "vtkSmartPointer.h" 27 #include "vtkDataSet.h" 28 #include "vtkDataArray.h" 29 #include "vtkAbstractCellLocator.h" 56 mirtkPublicAttributeMacro(vtkSmartPointer<vtkDataSet>, Domain);
59 mirtkPublicAttributeMacro(vtkSmartPointer<vtkDataArray>, Values);
62 mirtkAttributeMacro(vtkSmartPointer<vtkAbstractCellLocator>, Locator);
65 mirtkAttributeMacro(
int, MaxCellSize);
69 static const double _Tolerance2;
111 class Point Point(int i) const;
118 void GetPoint(
int i,
double &x,
double &y)
const;
126 void GetPoint(
int i,
double &x,
double &y,
double &z)
const;
132 void GetPoint(
int i,
double p[3])
const;
142 virtual void BoundingBox(
double &x1,
double &y1,
double &z1,
143 double &x2,
double &y2,
double &z2)
const;
160 vtkSmartPointer<vtkDataSet>
Codomain()
const;
172 void GetValue(
int i,
double *v)
const;
180 double Value(
int i,
int l = 0)
const;
190 virtual bool Evaluate(
double *v,
double x,
double y,
double z = 0)
const;
201 virtual double Evaluate(
double x,
double y,
double z = 0,
int l = 0)
const;
207 virtual bool Read(
const char *);
210 virtual bool Write(
const char *)
const;
221 return static_cast<int>(_Domain->GetNumberOfPoints());
227 _Domain->GetPoint(static_cast<vtkIdType>(i), p);
234 _Domain->GetPoint(static_cast<vtkIdType>(i), p);
242 _Domain->GetPoint(static_cast<vtkIdType>(i), p);
243 x = p[0], y = p[1], z = p[2];
257 _Values->GetTuple(static_cast<vtkIdType>(i), v);
263 return _Values->GetComponent(static_cast<vtkIdType>(i), l);
269 #endif // MIRTK_PiecewiseLinearMap_H void BoundingBox(double &x1, double &y1, double &x2, double &y2) const
int NumberOfPoints() const
Number of discrete points at which map values are given.
virtual void BoundingBox(double &x1, double &y1, double &z1, double &x2, double &y2, double &z2) const
virtual ~PiecewiseLinearMap()
Destructor.
virtual bool Evaluate(double *v, double x, double y, double z=0) const =0
virtual void Initialize()
Initialize map after inputs and parameters are set.
virtual int NumberOfComponents() const
Dimension of codomain, i.e., number of output values.
void GetPoint(int i, double &x, double &y) const
vtkSmartPointer< vtkDataSet > Codomain() const
double Value(int i, int l=0) const
class Point Point(int i) const
virtual bool Evaluate(double *v, double x, double y, double z=0) const
PiecewiseLinearMap & operator=(const PiecewiseLinearMap &)
Assignment operator.
void GetValue(int i, double *v) const
PiecewiseLinearMap()
Default constructor.
virtual bool Read(const char *)
Read map from file.
virtual bool Write(const char *) const
Write map to file.
virtual Mapping * NewCopy() const
Make deep copy of this volumetric map.