ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkFRPROptimizer.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkFRPROptimizer_h
00019 #define __itkFRPROptimizer_h
00020 
00021 #include "itkPowellOptimizer.h"
00022 
00023 namespace itk
00024 {
00049 class ITK_EXPORT FRPROptimizer:
00050   public PowellOptimizer
00051 {
00052 public:
00054   typedef FRPROptimizer              Self;
00055   typedef PowellOptimizer            Superclass;
00056   typedef SmartPointer< Self >       Pointer;
00057   typedef SmartPointer< const Self > ConstPointer;
00058 
00059   typedef SingleValuedNonLinearOptimizer::ParametersType ParametersType;
00060 
00062   itkNewMacro(Self);
00063 
00065   itkTypeMacro(FRPROptimizer, PowellOptimizer);
00066 
00068   typedef  SingleValuedCostFunction  CostFunctionType;
00069   typedef  CostFunctionType::Pointer CostFunctionPointer;
00070 
00072   itkSetMacro(UseUnitLengthGradient, bool);
00073   itkGetConstMacro(UseUnitLengthGradient, bool);
00075 
00077   void StartOptimization();
00078 
00080   void SetToFletchReeves();
00081 
00083   void SetToPolakRibiere();
00084 
00085 protected:
00086   FRPROptimizer();
00087   virtual ~FRPROptimizer();
00088 
00089   void PrintSelf(std::ostream & os, Indent indent) const;
00090 
00094   virtual void GetValueAndDerivative(ParametersType & p, double *val,
00095                                      ParametersType *xi);
00096 
00097   virtual void   LineOptimize(ParametersType *p, ParametersType & xi,
00098                               double *val);
00099 
00100   virtual void   LineOptimize(ParametersType *p, ParametersType & xi,
00101                               double *val,
00102                               ParametersType & tempCoord);
00103 
00104 private:
00105   FRPROptimizer(const FRPROptimizer &); // not implemented
00106 
00107   typedef enum {
00108     FletchReeves,
00109     PolakRibiere
00110     }               OptimizationType;
00111 
00112   OptimizationType m_OptimizationType;
00113 
00114   bool m_UseUnitLengthGradient;
00115 }; // end of class
00116 } // end of namespace itk
00117 
00118 #endif
00119