20 #ifndef MIRTK_PointSetForce_H 21 #define MIRTK_PointSetForce_H 23 #include "mirtk/EnergyTerm.h" 25 #include "mirtk/UnorderedMap.h" 26 #include "mirtk/Vector3D.h" 27 #include "mirtk/RegisteredPointSet.h" 30 #include "vtkSmartPointer.h" 31 #include "vtkDataArray.h" 32 #include "vtkPoints.h" 125 vtkPoints *
Points()
const;
131 vtkDataArray *
Status()
const;
140 const EdgeTable *
Edges()
const;
146 const NodeNeighbors *
Neighbors(
int = -1)
const;
152 typedef UnorderedMap<string, string> NameMap;
153 typedef NameMap::iterator NameMapIterator;
154 typedef NameMap::const_iterator NameMapConstIterator;
157 NameMap _PointDataName;
169 vtkDataArray *
PointData(
const char *name,
bool optional =
false)
const;
185 void AddPointData(
const char *name, vtkSmartPointer<vtkDataArray> &data,
bool global =
false);
210 vtkDataArray *
AddPointData(
const char *name,
int c = 1,
int type = VTK_FLOAT,
bool global =
false);
270 virtual void Update(
bool =
true);
280 virtual void EvaluateGradient(
double *gradient,
double step,
double weight);
287 virtual void WriteDataSets(
const char *,
const char *,
bool =
true)
const;
290 virtual void WriteGradient(
const char *,
const char *)
const;
301 if (_SurfaceForce)
return _PointSet->InputSurface();
302 else return _PointSet->InputPointSet();
308 if (_SurfaceForce)
return _PointSet->Surface();
309 else return _PointSet->PointSet();
315 return _PointSet->InputSurface();
321 return _PointSet->Surface();
327 return _SurfaceForce ? _PointSet->SurfacePoints() : _PointSet->Points();
333 return _SurfaceForce ? _PointSet->InitialSurfaceStatus() : _PointSet->InitialStatus();
339 return _SurfaceForce ? _PointSet->SurfaceStatus() : _PointSet->Status();
345 if (!_SurfaceForce) {
346 Throw(ERR_LogicError, __FUNCTION__,
"Only surface meshes have point normals!");
348 return _PointSet->SurfaceNormals();
354 return _SurfaceForce ? _PointSet->SurfaceEdges() : _PointSet->Edges();
360 return _SurfaceForce ? _PointSet->SharedSurfaceEdgeTable() : _PointSet->SharedEdgeTable();
366 return _SurfaceForce ? _PointSet->SurfaceNeighbors(n) : _PointSet->Neighbors(n);
378 #endif // MIRTK_PointSetForce_H vtkDataArray * InitialStatus() const
Get initial point status array.
mirtkPublicAttributeMacro(int, GradientAveraging)
Number of gradient averaging iterations.
PointSetForce & operator=(const PointSetForce &)
Assignment operator.
virtual void Initialize()
Initialize force term once input and parameters have been set.
vtkPointData * PointData() const
Get point data.
RegisteredPointSet::NodeNeighbors NodeNeighbors
Table of n-connected node neighbors.
virtual void Update(bool=true)
Update moving input points and internal state of force term.
vtkPointSet * OriginalPointSet() const
Get point set on which this force is acting on.
vtkSmartPointer< vtkPoints > GetInitialPoints() const
Get initial points, possibly pre-transformed by global transformation.
mirtkPublicAggregateMacro(RegisteredPointSet, PointSet)
Transformed point set.
mirtkReadOnlyAttributeMacro(bool, SurfaceForce)
SharedPtr< const EdgeTable > SharedEdgeTable() const
Get edge table of point set mesh.
vtkPointSet * DeformedPointSet() const
Get point set on which this force is acting on.
RegisteredPointSet::EdgeTable EdgeTable
Adjacency matrix with edge IDs.
void CopyAttributes(const PointSetForce &)
Copy attributes of this class from another instance.
Vector3D< double > GradientType
Type of gradient w.r.t a single transformed data point.
virtual ~PointSetForce()
Destructor.
virtual void Reinitialize()
const NodeNeighbors * Neighbors(int=-1) const
Get edge-connectivity table of point set node neighbors.
mirtkAttributeMacro(int, GradientSize)
Size of gradient vector.
mirtkAggregateMacro(int, Count)
void AllocateGradient(int)
Allocate memory for (non-parametric) gradient.
const EdgeTable * Edges() const
Get edge table of point set mesh.
void AddPointData(const char *name, vtkSmartPointer< vtkDataArray > &data, bool global=false)
virtual void WriteGradient(const char *, const char *) const
Write gradient of force term.
vtkPolyData * DeformedSurface() const
Get point set on which this force is acting on.
vtkPolyData * OriginalSurface() const
Get point set on which this force is acting on.
void RemovePointData(const char *name)
virtual void WriteDataSets(const char *, const char *, bool=true) const
Write input of force term.
vtkDataArray * Status() const
Get point status array.
vtkPoints * Points() const
Get points of point set on which this force is acting on.
void Throw(ErrorType err, const char *func, Args... args) const
void Init()
Common (re-)initialization steps of this class only (non-virtual function!)
void AllocateCount(int)
Allocate _Count memory.
virtual void EvaluateGradient(double *gradient, double step, double weight)
PointSetForce(const char *="", double=1.0)
Constructor.
mirtkComponentMacro(GradientType, Gradient)
Negative node forces/gradient of external force term.
void Gradient(double *gradient, double step)
vtkDataArray * Normals() const
Get point normals array.
int NumberOfPoints(vtkDataSet *)
Number of points.