ITK  5.2.0
Insight Toolkit
itkFRPROptimizer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 itkFRPROptimizer_h
19 #define itkFRPROptimizer_h
20 
21 #include "itkPowellOptimizer.h"
22 #include "ITKOptimizersExport.h"
23 
24 namespace itk
25 {
31 {
32 public:
36  enum class Optimization : uint8_t
37  {
40  };
41 };
42 // Define how to print enumeration
43 extern ITKOptimizers_EXPORT std::ostream &
44  operator<<(std::ostream & out, const FRPROptimizerEnums::Optimization value);
45 
70 class ITKOptimizers_EXPORT FRPROptimizer : public PowellOptimizer
71 {
72 public:
73  ITK_DISALLOW_COPY_AND_MOVE(FRPROptimizer);
79 
81 
83  itkNewMacro(Self);
84 
86  itkTypeMacro(FRPROptimizer, PowellOptimizer);
87 
91 
93  itkSetMacro(UseUnitLengthGradient, bool);
94  itkGetConstMacro(UseUnitLengthGradient, bool);
96 
98  void
99  StartOptimization() override;
100 
102  void
103  SetToFletchReeves();
104 
106  void
107  SetToPolakRibiere();
108 
109 protected:
110  FRPROptimizer();
111  ~FRPROptimizer() override;
112 
113  void
114  PrintSelf(std::ostream & os, Indent indent) const override;
115 
119  virtual void
120  GetValueAndDerivative(ParametersType & p, double * val, ParametersType * xi);
121 
122  virtual void
123  LineOptimize(ParametersType * p, ParametersType & xi, double * val);
124 
125  virtual void
126  LineOptimize(ParametersType * p, ParametersType & xi, double * val, ParametersType & tempCoord);
127 
128 private:
130 #if !defined(ITK_LEGACY_REMOVE)
131 
132  static constexpr OptimizationEnum FletchReeves = OptimizationEnum::FletchReeves;
133  static constexpr OptimizationEnum PolakRibiere = OptimizationEnum::PolakRibiere;
134 #endif
135 
137 
139 }; // end of class
140 } // end of namespace itk
141 
142 #endif
itk::FRPROptimizer
Implements Fletch-Reeves & Polak-Ribiere optimization using dBrent line search.
Definition: itkFRPROptimizer.h:70
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::OptimizerParameters< double >
itk::FRPROptimizerEnums::Optimization::PolakRibiere
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:218
itk::FRPROptimizerEnums
Contains enum classes used by FRPROptimizer class.
Definition: itkFRPROptimizer.h:30
itk::FRPROptimizer::m_OptimizationType
OptimizationEnum m_OptimizationType
Definition: itkFRPROptimizer.h:136
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::FRPROptimizer::m_UseUnitLengthGradient
bool m_UseUnitLengthGradient
Definition: itkFRPROptimizer.h:138
Optimization
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::SingleValuedCostFunction
This class is a base for the CostFunctions returning a single value.
Definition: itkSingleValuedCostFunction.h:34
itkPowellOptimizer.h
itk::PowellOptimizer
Implements Powell optimization using Brent line search.
Definition: itkPowellOptimizer.h:62
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::FRPROptimizerEnums::Optimization::FletchReeves
itk::SingleValuedNonLinearOptimizer::ParametersType
Superclass::ParametersType ParametersType
Definition: itkSingleValuedNonLinearOptimizer.h:54
itk::FRPROptimizerEnums::Optimization
Optimization
Definition: itkFRPROptimizer.h:36