ITK  6.0.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  * https://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  itkOverrideGetNameOfClassMacro(FRPROptimizer);
87 
91 
93  itkSetMacro(UseUnitLengthGradient, bool);
94  itkGetConstMacro(UseUnitLengthGradient, bool);
95  itkBooleanMacro(UseUnitLengthGradient);
99  void
100  StartOptimization() override;
101 
103  void
104  SetToFletchReeves();
105 
107  void
108  SetToPolakRibiere();
109 
110 protected:
111  FRPROptimizer();
112  ~FRPROptimizer() override;
113 
114  void
115  PrintSelf(std::ostream & os, Indent indent) const override;
116 
120  virtual void
121  GetValueAndDerivative(ParametersType & p, double * val, ParametersType * xi);
122 
123  virtual void
124  LineOptimize(ParametersType * p, ParametersType & xi, double * val);
125 
126  virtual void
127  LineOptimize(ParametersType * p, ParametersType & xi, double * val, ParametersType & tempCoord);
128 
129 private:
131 #if !defined(ITK_LEGACY_REMOVE)
132 
133  static constexpr OptimizationEnum FletchReeves = OptimizationEnum::FletchReeves;
134  static constexpr OptimizationEnum PolakRibiere = OptimizationEnum::PolakRibiere;
135 #endif
136 
137  OptimizationEnum m_OptimizationType{};
138 
139  bool m_UseUnitLengthGradient{};
140 }; // end of class
141 } // end of namespace itk
142 
143 #endif
itk::FRPROptimizer
Implements Fletch-Reeves & Polak-Ribiere optimization using dBrent line search.
Definition: itkFRPROptimizer.h:70
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::OptimizerParameters< double >
itk::FRPROptimizerEnums::Optimization::PolakRibiere
itk::FRPROptimizerEnums
Contains enum classes used by FRPROptimizer class.
Definition: itkFRPROptimizer.h:30
itk::operator<<
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Optimization
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
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: itkAnatomicalOrientation.h:29
itk::FRPROptimizerEnums::Optimization::FletchReeves
itk::SingleValuedNonLinearOptimizer::ParametersType
Superclass::ParametersType ParametersType
Definition: itkSingleValuedNonLinearOptimizer.h:54
itk::FRPROptimizerEnums::Optimization
Optimization
Definition: itkFRPROptimizer.h:36