ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkExhaustiveOptimizer.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 __itkExhaustiveOptimizer_h
00019 #define __itkExhaustiveOptimizer_h
00020 
00021 #include "itkIntTypes.h"
00022 #include "itkSingleValuedNonLinearOptimizer.h"
00023 
00024 namespace itk
00025 {
00082 class ITK_EXPORT ExhaustiveOptimizer:
00083   public SingleValuedNonLinearOptimizer
00084 {
00085 public:
00087   typedef ExhaustiveOptimizer            Self;
00088   typedef SingleValuedNonLinearOptimizer Superclass;
00089   typedef SmartPointer< Self >           Pointer;
00090   typedef SmartPointer< const Self >     ConstPointer;
00091 
00092   typedef Array< SizeValueType > StepsType;
00094   itkNewMacro(Self);
00095 
00097   itkTypeMacro(ExhaustiveOptimizer, SingleValuedNonLinearOptimizer);
00098 
00099   virtual void    StartOptimization(void);
00100 
00101   void StartWalking(void);
00102 
00103   void ResumeWalking(void);
00104 
00105   void StopWalking(void);
00106 
00107   itkSetMacro(StepLength, double);
00108   itkSetMacro(NumberOfSteps, StepsType);
00109   itkGetConstReferenceMacro(StepLength, double);
00110   itkGetConstReferenceMacro(NumberOfSteps, StepsType);
00111   itkGetConstReferenceMacro(CurrentValue, MeasureType);
00112   itkGetConstReferenceMacro(MaximumMetricValue, MeasureType);
00113   itkGetConstReferenceMacro(MinimumMetricValue, MeasureType);
00114   itkGetConstReferenceMacro(MinimumMetricValuePosition, ParametersType);
00115   itkGetConstReferenceMacro(MaximumMetricValuePosition, ParametersType);
00116   itkGetConstReferenceMacro(CurrentIndex, ParametersType);
00117   itkGetConstReferenceMacro(MaximumNumberOfIterations, SizeValueType);
00118 
00120   const std::string GetStopConditionDescription() const;
00121 
00122 protected:
00123   ExhaustiveOptimizer();
00124   virtual ~ExhaustiveOptimizer() {}
00125   void PrintSelf(std::ostream & os, Indent indent) const;
00126 
00128   void AdvanceOneStep(void);
00129 
00130   void IncrementIndex(ParametersType & param);
00131 
00132 protected:
00133   MeasureType m_CurrentValue;
00134 
00135   StepsType m_NumberOfSteps;
00136 
00137   SizeValueType m_CurrentIteration;
00138 
00139   bool m_Stop;
00140 
00141   unsigned int m_CurrentParameter;
00142 
00143   double m_StepLength;
00144 
00145   ParametersType m_CurrentIndex;
00146 
00147   SizeValueType m_MaximumNumberOfIterations;
00148 
00149   MeasureType m_MaximumMetricValue;
00150 
00151   MeasureType m_MinimumMetricValue;
00152 
00153   ParametersType m_MinimumMetricValuePosition;
00154 
00155   ParametersType m_MaximumMetricValuePosition;
00156 private:
00157   //purposely not implemented
00158   ExhaustiveOptimizer(const Self &);
00159   void operator=(const Self &);
00160 
00161   std::ostringstream m_StopConditionDescription;
00162 };
00163 } // end namespace itk
00164 
00165 #endif
00166