SpringForce.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_SpringForce_H
21 #define MIRTK_SpringForce_H
22 
23 #include "mirtk/SurfaceConstraint.h"
24 #include "mirtk/EdgeTable.h"
25 
26 #include "vtkSmartPointer.h"
27 #include "vtkPolyData.h"
28 #include "vtkDataArray.h"
29 
30 
31 namespace mirtk {
32 
33 
34 /**
35  * Surface smoothness force based on discrete Laplace operator
36  *
37  * This internal deformable surface force is based on the umbrella
38  * operator which approximates the discrete Laplace operator.
39  *
40  * It corresponds to the "spring forces" employed by FreeSurfer's surface tools:
41  *
42  * Dale et al., Cortical Surface-Based Analysis I:
43  * Segmentation and Surface Reconstruction. NeuroImage, 9(2), 179–194 (1999).
44  *
45  * Fischl et al., Cortical Surface-Based Analysis II: Inflation, Flattening,
46  * and a Surface-Based Coordinate System. NeuroImage, 9(2), 195–207 (1999).
47  *
48  * And the "tensile force" used by McInerney and Terzopoulos:
49  *
50  * McInerney and Terzopoulos, Topology adaptive deformable surfaces for medical
51  * image volume segmentation. IEEE Transactions on Medical Imaging, 18(10),
52  * 840–850, doi:10.1109/42.811261 (1999)
53  *
54  * \sa Other smoothness terms: CurvatureConstraint, QuadraticCurvatureConstraint
55  */
57 {
58  mirtkEnergyTermMacro(SpringForce, EM_SpringForce);
59 
60  // ---------------------------------------------------------------------------
61  // Attributes
62 
63  /// Weight of normal component
64  mirtkPublicAttributeMacro(double, InwardNormalWeight);
65 
66  /// Weight of normal component
67  mirtkPublicAttributeMacro(double, OutwardNormalWeight);
68 
69  /// Weight of tangential component
70  mirtkPublicAttributeMacro(double, TangentialWeight);
71 
72  /// Copy attributes of this class from another instance
73  void CopyAttributes(const SpringForce &);
74 
75  // ---------------------------------------------------------------------------
76  // Construction/Destruction
77 
78 public:
79 
80  /// Constructor
81  SpringForce(const char * = "", double = 1.0);
82 
83  /// Copy constructor
84  SpringForce(const SpringForce &);
85 
86  /// Assignment operator
88 
89  /// Destructor
90  virtual ~SpringForce();
91 
92  // ---------------------------------------------------------------------------
93  // Evaluation
94 
95 protected:
96 
97  /// Evaluate energy of internal force term
98  virtual double Evaluate();
99 
100  /// Evaluate internal force w.r.t. transformation parameters or surface nodes
101  virtual void EvaluateGradient(double *, double, double);
102 
103 };
104 
105 
106 } // namespace mirtk
107 
108 #endif // MIRTK_SpringForce_H
SpringForce(const char *="", double=1.0)
Constructor.
virtual ~SpringForce()
Destructor.
virtual double Evaluate()
Evaluate energy of internal force term.
Definition: IOConfig.h:41
virtual void EvaluateGradient(double *, double, double)
Evaluate internal force w.r.t. transformation parameters or surface nodes.
Spring force.
Definition: EnergyMeasure.h:90
SpringForce & operator=(const SpringForce &)
Assignment operator.