EulerMethodWithMomentum.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_EulerMethodWithMomentum_H
21 #define MIRTK_EulerMethodWithMomentum_H
22 
23 #include "mirtk/EulerMethod.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Minimizes deformable surface model using Euler's method with momentum
31  *
32  * This method is used by the FreeSurfer tools:
33  *
34  * Fischl et al., Cortical Surface-Based Analysis II: Inflation, Flattening,
35  * and a Surface-Based Coordinate System. NeuroImage, 9(2), 195–207 (1999).
36  *
37  * Another variant of an Euler method with momentum is implemented by
38  * EulerMethodWithDamping.
39  */
41 {
43 
44  // ---------------------------------------------------------------------------
45  // Attributes
46 
47  /// Momentum factor
48  mirtkPublicAttributeMacro(double, Momentum);
49 
50  /// Whether to exclude the momentum component from the total displacements
51  /// in normal direction. By default, the _Displacement in normal direction
52  /// by which a node is actually moved is integrated.
53  mirtkPublicAttributeMacro(bool, ExcludeMomentumFromNormalDisplacement);
54 
55  /// Copy attributes of this class from another instance
56  void CopyAttributes(const EulerMethodWithMomentum &);
57 
58  // ---------------------------------------------------------------------------
59  // Construction/Destruction
60 public:
61 
62  /// Constructor
64 
65  /// Copy constructor
67 
68  /// Assignment operator
70 
71  /// Destructor
72  virtual ~EulerMethodWithMomentum();
73 
74  // ---------------------------------------------------------------------------
75  // Parameters
77 
78  /// Set parameter value from string
79  virtual bool Set(const char *, const char *);
80 
81  /// Get parameters as key/value as string map
82  virtual ParameterList Parameter() const;
83 
84  // ---------------------------------------------------------------------------
85  // Execution
86 
87  /// Initialize optimization
88  ///
89  /// This member funtion is implicitly called by Run.
90  virtual void Initialize();
91 
92 protected:
93 
94  /// Update node displacements
95  virtual void UpdateDisplacement();
96 
97  /// Update recorded node displacement in normal direction
98  virtual void UpdateNormalDisplacement();
99 
100 };
101 
102 
103 } // namespace mirtk
104 
105 #endif // MIRTK_EulerMethodWithMomentum_H
virtual ~EulerMethodWithMomentum()
Destructor.
virtual bool Set(const char *, const char *)
Set parameter value from string.
virtual ParameterList Parameter() const
Get parameters as key/value as string map.
Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
Definition: Object.h:38
virtual ParameterList Parameter() const
Get parameters as key/value as string map.
EulerMethodWithMomentum & operator=(const EulerMethodWithMomentum &)
Assignment operator.
Definition: IOConfig.h:41
virtual void UpdateNormalDisplacement()
Update recorded node displacement in normal direction.
EulerMethodWithMomentum(ObjectiveFunction *=NULL)
Constructor.
virtual void UpdateDisplacement()
Update node displacements.
Explicit Euler method with momentum for deformable surface models.