ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVariationalRegistrationStopCriterion.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkVariationalRegistrationStopCriterion_h
19 #define itkVariationalRegistrationStopCriterion_h
20 
21 #include "itkCommand.h"
22 #include "itkEventObject.h"
23 
26 
27 namespace itk {
28 
67 template< typename TRegistrationFilter, typename TMRFilter >
69  : public Command
70 {
71 public:
72  ITK_DISALLOW_COPY_AND_ASSIGN(VariationalRegistrationStopCriterion);
73 
79 
81  using RegistrationFilterType = TRegistrationFilter;
82  using MRFilterType = TMRFilter;
83 
85  itkNewMacro(Self);
86 
91  itkSetMacro( IterationModulus, int );
92 
94  itkGetMacro( IterationModulus, int );
95 
97  itkSetMacro( PerformIncreaseCountCheck, bool );
98  itkGetMacro( PerformIncreaseCountCheck, bool );
99  itkBooleanMacro( PerformIncreaseCountCheck );
101 
103  itkSetMacro( MaximumIncreaseCount, int );
104 
106  itkGetMacro( MaximumIncreaseCount, int );
107 
109  itkSetMacro( PerformLineFittingCheck, bool );
110  itkGetMacro( PerformLineFittingCheck, bool );
111  itkBooleanMacro( PerformLineFittingCheck );
113 
117  itkSetMacro( PerformLineFittingMaxDistanceCheck, bool );
118  itkGetMacro( PerformLineFittingMaxDistanceCheck, bool );
119  itkBooleanMacro( PerformLineFittingMaxDistanceCheck );
121 
125  itkSetMacro( LineFittingUseAbsoluteValues, bool );
126  itkGetMacro( LineFittingUseAbsoluteValues, bool );
127  itkBooleanMacro( LineFittingUseAbsoluteValues );
129 
137  virtual void SetNumberOfFittingIterations( const int it );
138 
140  itkGetMacro( NumberOfFittingIterations, int );
141 
143  itkSetMacro( RegressionLineSlopeThreshold, double );
144 
146  itkGetMacro( RegressionLineSlopeThreshold, double );
147 
149  itkSetMacro( MaxDistanceToRegressionLine, double );
150 
152  itkGetMacro( MaxDistanceToRegressionLine, double );
153 
159  };
160 
166  itkSetEnumMacro( LineFittingMode, LineFittingMode );
167 
169  itkGetEnumMacro( LineFittingMode, LineFittingMode );
170 
174 
178 
182 
188  };
189 
198  itkSetEnumMacro( MultiResolutionPolicy, MultiResolutionPolicy );
199 
201  itkGetEnumMacro( MultiResolutionPolicy, MultiResolutionPolicy );
202 
206 
212 
220 
221  void Execute( itk::Object *caller, const itk::EventObject & event ) override;
222 
223  void Execute( const itk::Object *caller, const itk::EventObject & event ) override;
224 
225 protected:
228 
230  void PrintSelf(std::ostream& os, Indent indent) const override;
231 
234  virtual void SetModeForNextLevel(
235  const unsigned int nextLevel, const unsigned int numberOfLevels );
236 
239  virtual void SetNextMetricValue( const double value );
240 
242  virtual void ResetFittingData();
243 
246  virtual bool CheckStopRegistration();
247 
249  virtual void FitLine( const double *const x, const double *const y,
250  const int n, double *m, double *b);
251 
252 private:
253  // Stop criterion multi-resolution policy.
255 
256  // General parameter.
257  int m_IterationModulus; // Only check every mod iterations.
258  int m_ElapsedIterations; // The number of elapsed iterations.
259 
260  // Member for increase count calculation.
261  bool m_PerformIncreaseCountCheck; // Perform increase count check?
262 
265 
266  double m_MaxMetricValue; // Stores max metric value.
267  double m_MinMetricValue; // Stores min metric value.
268 
269  // Member for line fitting.
272  bool m_LineFittingUseAbsoluteValues; // Use absolute values for line fitting.
273 
274  LineFittingMode m_LineFittingMode; // Mode for the line fitting.
275 
279 
280  // Distance and iteration array.
284 };
285 
286 } // end namespace itk
287 
288 #ifndef ITK_MANUAL_INSTANTIATION
289 #include "itkVariationalRegistrationStopCriterion.hxx"
290 #endif
291 
292 #endif
virtual void SetNextMetricValue(const double value)
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetModeForNextLevel(const unsigned int nextLevel, const unsigned int numberOfLevels)
Abstraction of the Events used to communicating among filters and with GUIs.
virtual void SetLineFittingMode(const LineFittingMode _arg)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void FitLine(const double *const x, const double *const y, const int n, double *m, double *b)
Base class for most ITK classes.
Definition: itkObject.h:60
virtual void SetMultiResolutionPolicy(const MultiResolutionPolicy _arg)
Superclass for callback/observer methods.
Definition: itkCommand.h:44
void Execute(itk::Object *caller, const itk::EventObject &event) override
virtual void SetNumberOfFittingIterations(const int it)
A flexible stop criterion for the variational registration framework.