InflationStoppingCriterion.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_InflationStoppingCriterion_H
21 #define MIRTK_InflationStoppingCriterion_H
22 
23 #include "mirtk/StoppingCriterion.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Stopping criterion for cortical surface inflation
31  */
33 {
34  mirtkObjectMacro(InflationStoppingCriterion);
35 
36  // ---------------------------------------------------------------------------
37  // Attributes
38 
39  /// Convexity/concavity threshold
40  mirtkPublicAttributeMacro(double, Threshold);
41 
42  /// Normalized average distance of vertex neighbors to the tangent plane
43  mirtkReadOnlyAttributeMacro(double, AverageDistance);
44 
45  /// Copy attributes of this class from another instance
46  void CopyAttributes(const InflationStoppingCriterion &other);
47 
48  // ---------------------------------------------------------------------------
49  // Construction/Destruction
50 public:
51 
52  /// Constructor
54 
55  /// Copy constructor
57 
58  /// Assignment operator
60 
61  /// Create new copy of this instance
62  virtual StoppingCriterion *New() const;
63 
64  /// Destructor
66 
67  // ---------------------------------------------------------------------------
68  // Evaluation
69 
70  /// Test surface inflation stopping criterion
71  ///
72  /// Fischl et al., Cortical Surface-Based Analysis II: Inflation, Flattening,
73  /// and a Surface-Based Coordinate System. NeuroImage, 9(2), 195–207 (1999).
74  ///
75  /// \param[in] iter Current number of iterations (unused).
76  /// \param[in] value Objective function value at currentiteration (unused).
77  /// \param[in] delta Last change of objective function parameters (unused).
78  ///
79  /// \returns Whether stopping criterion is fulfilled.
80  virtual bool Fulfilled(int iter, double value, const double *delta);
81 
82  // ---------------------------------------------------------------------------
83  // Logging
84 
85  /// Print current stopping criterion status / value
86  ///
87  /// This function must be called after Fulfilled, which should update any
88  /// cached values that are needed by this function to avoid a costly
89  /// reevaluation of the stopping criterion.
90  ///
91  /// \note The printed string is expected to be considerably short and must
92  /// not end with a newline or space characters.
93  virtual void Print(ostream &) const;
94 
95 };
96 
97 
98 } // namespace mirtk
99 
100 #endif // MIRTK_InflationStoppingCriterion_H
Definition: IOConfig.h:41
virtual ~InflationStoppingCriterion()
Destructor.
virtual StoppingCriterion * New() const
Create new copy of this instance.
virtual bool Fulfilled(int iter, double value, const double *delta)
InflationStoppingCriterion(const ObjectiveFunction *=NULL)
Constructor.
InflationStoppingCriterion & operator=(const InflationStoppingCriterion &)
Assignment operator.
virtual void Print(ostream &) const