QuadraticCurvatureConstraint.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_QuadraticCurvatureConstraint_H
21 #define MIRTK_QuadraticCurvatureConstraint_H
22 
23 #include "mirtk/SurfaceConstraint.h"
24 
25 #include "mirtk/Array.h"
26 
27 
28 namespace mirtk {
29 
30 
31 /**
32  * Surface curvature constraint
33  *
34  * This surface constraint fits a 1D quadratic to the surface locally
35  * and moves the vertex in the normal direction to improve the fit.
36  * It is based on FreeSurfer's equivalent mrisComputeQuadraticCurvatureTerm
37  * function defined in the mrisurf.c open source file.
38  */
40 {
42 
43  // ---------------------------------------------------------------------------
44  // Attributes
45 
46  /// Copy attributes of this class from another instance
47  void CopyAttributes(const QuadraticCurvatureConstraint &);
48 
49  // ---------------------------------------------------------------------------
50  // Construction/Destruction
51 
52 public:
53 
54  /// Constructor
55  QuadraticCurvatureConstraint(const char * = "", double = 1.0);
56 
57  /// Copy constructor
59 
60  /// Assignment operator
62 
63  /// Destructor
65 
66  // ---------------------------------------------------------------------------
67  // Evaluation
68 
69  /// Initialize force term once input and parameters have been set
70  virtual void Initialize();
71 
72  /// Update internal force data structures
73  virtual void Update(bool);
74 
75 protected:
76 
77  /// Compute penalty for current transformation estimate
78  virtual double Evaluate();
79 
80  /// Compute internal force w.r.t. transformation parameters
81  virtual void EvaluateGradient(double *, double, double);
82 
83 };
84 
85 
86 } // namespace mirtk
87 
88 #endif // MIRTK_QuadraticCurvatureConstraint_H
Quadratic fit of neighor to tangent plane distance.
Definition: EnergyMeasure.h:83
QuadraticCurvatureConstraint(const char *="", double=1.0)
Constructor.
virtual void Initialize()
Initialize force term once input and parameters have been set.
virtual ~QuadraticCurvatureConstraint()
Destructor.
Definition: IOConfig.h:41
QuadraticCurvatureConstraint & operator=(const QuadraticCurvatureConstraint &)
Assignment operator.
virtual void Update(bool)
Update internal force data structures.
virtual void EvaluateGradient(double *, double, double)
Compute internal force w.r.t. transformation parameters.
virtual double Evaluate()
Compute penalty for current transformation estimate.