ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkOptimizer.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 __itkOptimizer_h
00019 #define __itkOptimizer_h
00020 
00021 #include "itkObject.h"
00022 #include "itkObjectFactory.h"
00023 #include "itkArray.h"
00024 #include "itkOptimizerParameters.h"
00025 
00026 namespace itk
00027 {
00037 class ITK_EXPORT Optimizer:public Object
00038 {
00039 public:
00041   typedef Optimizer                  Self;
00042   typedef Object                     Superclass;
00043   typedef SmartPointer< Self >       Pointer;
00044   typedef SmartPointer< const Self > ConstPointer;
00045 
00047   itkNewMacro(Self);
00048 
00050   itkTypeMacro(Optimizer, Object);
00051 
00054   typedef OptimizerParameters< double > ParametersType;
00055 
00062   typedef Array< double > ScalesType;
00063 
00065   virtual void SetInitialPosition(const ParametersType & param);
00066 
00068   itkGetConstReferenceMacro(InitialPosition, ParametersType);
00069 
00071   void SetScales(const ScalesType & scales);
00072 
00074   itkGetConstReferenceMacro(Scales, ScalesType);
00075 
00077   itkGetConstReferenceMacro(CurrentPosition, ParametersType);
00078 
00080   virtual void StartOptimization() {}
00081 
00083   virtual const std::string GetStopConditionDescription() const;
00084 
00085 protected:
00086   Optimizer();
00087   virtual ~Optimizer() {}
00088   void PrintSelf(std::ostream & os, Indent indent) const;
00089 
00091   virtual void SetCurrentPosition(const ParametersType & param);
00092 
00093   bool m_ScalesInitialized;
00094 
00095   // Keep m_CurrentPosition as a protected var so that subclasses can
00096   // have fast access.  This is important when optimizing high-dimensional
00097   // spaces, e.g. bspline transforms.
00098   ParametersType m_CurrentPosition;
00099 private:
00100   Optimizer(const Self &);      //purposely not implemented
00101   void operator=(const Self &); //purposely not implemented
00102 
00103   ParametersType m_InitialPosition;
00104   ScalesType     m_Scales;
00105 };
00106 } // end namespace itk
00107 
00108 #endif
00109