ITK  4.13.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:
93  virtual ~MultipleValuedNonLinearVnlOptimizer() ITK_OVERRIDE;
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  ITK_DISALLOW_COPY_AND_ASSIGN(MultipleValuedNonLinearVnlOptimizer);
117 
119  void IterationReport(const EventObject & event);
120 
121  CostFunctionAdaptorType *m_CostFunctionAdaptor;
122  bool m_UseGradient;
123 
124  CommandType::Pointer m_Command;
125 
126  mutable ParametersType m_CachedCurrentPosition;
127  mutable MeasureType m_CachedValue;
128  mutable DerivativeType m_CachedDerivative;
129 };
130 } // end namespace itk
131 
132 #endif
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:166
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...