ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkMultipleValuedNonLinearVnlOptimizer.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 itkMultipleValuedNonLinearVnlOptimizer_h
19 #define itkMultipleValuedNonLinearVnlOptimizer_h
20 
23 #include "itkCommand.h"
24 #include "ITKOptimizersExport.h"
25 
26 namespace itk
27 {
37 class ITKOptimizers_EXPORT MultipleValuedNonLinearVnlOptimizer:
39 {
40 public:
46 
49  MultipleValueNonLinearOptimizer);
50 
53  typedef Superclass::ParametersType ParametersType;
54 
61  virtual void SetCostFunction(MultipleValuedCostFunction *costFunction) ITK_OVERRIDE = 0;
62 
66  void SetUseCostFunctionGradient(bool);
67 
69  {
70  this->SetUseCostFunctionGradient(true);
71  }
72 
74  {
75  this->SetUseCostFunctionGradient(false);
76  }
77 
78  bool GetUseCostFunctionGradient() const;
79 
86  itkGetConstReferenceMacro(CachedValue, MeasureType);
87  itkGetConstReferenceMacro(CachedDerivative, DerivativeType);
88  itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType);
90 
91 protected:
94 
95  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
96 
98 
99  void SetCostFunctionAdaptor(CostFunctionAdaptorType *adaptor);
100 
101  const CostFunctionAdaptorType * GetCostFunctionAdaptor() const;
102 
103  CostFunctionAdaptorType * GetCostFunctionAdaptor();
104 
107  CostFunctionAdaptorType * GetNonConstCostFunctionAdaptor() const;
108 
114 
115 private:
116  MultipleValuedNonLinearVnlOptimizer(const Self &) ITK_DELETE_FUNCTION;
117  void operator=(const Self &) ITK_DELETE_FUNCTION;
118 
120  void IterationReport(const EventObject & event);
121 
122  CostFunctionAdaptorType *m_CostFunctionAdaptor;
123  bool m_UseGradient;
124 
125  CommandType::Pointer m_Command;
126 
127  mutable ParametersType m_CachedCurrentPosition;
128  mutable MeasureType m_CachedValue;
129  mutable DerivativeType m_CachedDerivative;
130 };
131 } // end namespace itk
132 
133 #endif
MultipleValuedVnlCostFunctionAdaptor CostFunctionAdaptorType
Light weight base class for most itk classes.
This class is a base for the Optimization methods that optimize a multi-valued function.
This class is a base for the CostFunctions returning a multiple values.
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
This class is a base for the Optimization methods that optimize a multiple valued function...
A Command subclass that calls a pointer to a member function.
Definition: itkCommand.h:168
Abstraction of the Events used to communicating among filters and with GUIs.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
This class is an Adaptor that allows to pass itk::MultipleValuedCostFunctions to vnl_optimizers expec...