Deformetrica

OrientedPolyLine.h
1 /***************************************************************************************
2 * *
3 * Deformetrica *
4 * *
5 * Copyright Inria and the University of Utah. All rights reserved. This file is *
6 * distributed under the terms of the Inria Non-Commercial License Agreement. *
7 * *
8 * *
9 ****************************************************************************************/
10 
11 #ifndef _OrientedPolyLine_h
12 #define _OrientedPolyLine_h
13 
14 #include "DeformableObject.h"
15 #include "Landmark.h"
16 
17 #include "Diffeos.h"
18 
19 #include "vnl/vnl_matrix.h"
20 
21 #include "itkSimpleFastMutexLock.h"
22 
23 #include "vtkPolyData.h"
24 #include "vtkSmartPointer.h"
25 
26 #include <vector>
27 
28 #include <cstring>
29 #include <iostream>
30 #include <sstream>
31 
41 template <class TScalar, unsigned int Dimension>
42 class OrientedPolyLine : public Landmark<TScalar, Dimension>
43 {
44 public:
45 
47  // typedef :
49 
52 
55 
62 
65 
66 
67 
69  // Constructor(s) / Destructor :
71 
74  OrientedPolyLine(const OrientedPolyLine& other);
75 
76  virtual OrientedPolyLine* Clone() { return new OrientedPolyLine(*this); }
77 
78  virtual ~OrientedPolyLine();
79 
80 
82  // Encapsulation method(s) :
84 
85  virtual void SetPolyData(vtkPolyData* polyData);
86 
88  inline VNLMatrixType GetCenters() const { return m_Centers; }
89 
91  inline VNLMatrixType GetTangents() const { return m_Tangents; }
92 
94  inline int GetNumberOfCells() const { return m_NumCells; }
95 
97  inline TScalar GetKernelWidth() const { return m_KernelWidth; }
99  void SetKernelWidth(TScalar h);
100 
102  inline TScalar GetNormSquared() const { return m_NormSquared; }
103 
104 
105 
107  // Other method(s) :
109 
111  virtual TScalar ComputeMatch(DeformableObjectType* target);
113  virtual TScalar ComputeMatch(DeformableObjectType* target, unsigned int t);
114 
118  virtual VNLMatrixType ComputeMatchGradient(DeformableObjectType* target, unsigned int );
119 
120 
121 
122 protected:
123 
125  // Method(s) :
127 
138  void ComputeCentersTangents(const VNLMatrixType& Pts, VNLMatrixType& Centers, VNLMatrixType& Tangents);
139 
141  TScalar ComputeSelfNorm();
142 
143 
144 
146  // Attribute(s)
148 
151 
154 
157 
159  TScalar m_KernelWidth;
160 
162  TScalar m_NormSquared;
163 
165  itk::SimpleFastMutexLock m_VTKMutex;
166 
167 
168 }; /* class OrientedPolyLine */
169 
170 
171 #ifndef MU_MANUAL_INSTANTIATION
172 #include "OrientedPolyLine.txx"
173 #endif
174 
175 
176 #endif /* _OrientedPolyLine_h */
Oriented curves.
Definition: OrientedPolyLine.h:42
Superclass::VNLMatrixList VNLMatrixList
List of matrices type.
Definition: OrientedPolyLine.h:61
TScalar m_KernelWidth
Size of the kernel.
Definition: OrientedPolyLine.h:159
virtual OrientedPolyLine * Clone()
Makes a copy of the object.
Definition: OrientedPolyLine.h:76
VNLMatrixType GetTangents() const
Returns the tangents of the cells.
Definition: OrientedPolyLine.h:91
TScalar GetNormSquared() const
Returns the squared RKHS-norm of itself.
Definition: OrientedPolyLine.h:102
TScalar m_NormSquared
Squared RKHS-norm of the oriented curve.
Definition: OrientedPolyLine.h:162
TScalar GetKernelWidth() const
Returns the size of the kernel.
Definition: OrientedPolyLine.h:97
Standard diffeomorphisms.
Definition: Diffeos.h:27
Superclass::VNLVectorType VNLVectorType
Vector type.
Definition: OrientedPolyLine.h:57
virtual void SetPolyData(vtkPolyData *polyData)
Sets the pointer on a VTK object to polyData.
DeformableObject< TScalar, Dimension > Superclass
Deformable object type.
Definition: Landmark.h:51
int m_NumCells
Number of cells (i.e. polygonal lines).
Definition: OrientedPolyLine.h:156
int GetNumberOfCells() const
Returns the number of cells.
Definition: OrientedPolyLine.h:94
Superclass::DiffeosType DiffeosType
Deformation type.
Definition: OrientedPolyLine.h:64
vnl_matrix< TScalar > VNLMatrixType
Matrix type.
Definition: DeformableObject.h:55
std::vector< VNLMatrixType > VNLMatrixList
List of matrices type.
Definition: DeformableObject.h:57
virtual TScalar ComputeMatch(DeformableObjectType *target)
See DeformableObject::ComputeMatch(DeformableObject* target) for details.
Landmarks (i.e. labelled point sets)
Definition: Landmark.h:42
itk::SimpleFastMutexLock m_VTKMutex
See Landmark::m_VTKMutex for details.
Definition: OrientedPolyLine.h:165
virtual VNLMatrixType ComputeMatchGradient(DeformableObjectType *target)
See DeformableObject::ComputeMatchGradient(DeformableObject* target) for details. ...
VNLMatrixType GetCenters() const
Returns the centers of the cells.
Definition: OrientedPolyLine.h:88
vnl_vector< TScalar > VNLVectorType
Vector type.
Definition: DeformableObject.h:53
Superclass::VNLMatrixType VNLMatrixType
Matrix type.
Definition: Landmark.h:56
Superclass::VNLMatrixType VNLMatrixType
Matrix type.
Definition: OrientedPolyLine.h:59
VNLMatrixType m_Tangents
Matrix coordinates of the tangents of the cells (Size : NumCells x Dimension).
Definition: OrientedPolyLine.h:153
void SetKernelWidth(TScalar h)
Sets the size of the kernel to h.
VNLMatrixType m_Centers
Matrix coordinates of the centers of the cells (Size : NumCells x Dimension).
Definition: OrientedPolyLine.h:150
void ComputeCentersTangents(const VNLMatrixType &Pts, VNLMatrixType &Centers, VNLMatrixType &Tangents)
Computes the centers and the normals from the points.
TScalar ComputeSelfNorm()
Computes the RKHS-norm of itself.
Superclass::Superclass DeformableObjectType
Deformable object type.
Definition: OrientedPolyLine.h:54
Landmark< TScalar, Dimension > Superclass
Landmark type.
Definition: OrientedPolyLine.h:51