Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __itkFullSearchOptimizer_h
00016 #define __itkFullSearchOptimizer_h
00017
00018 #include "itkSingleValuedNonLinearOptimizer.h"
00019 #include "itkMapContainer.h"
00020 #include "itkImage.h"
00021 #include "itkArray.h"
00022 #include "itkFixedArray.h"
00023
00024
00025 namespace itk
00026 {
00027
00043 class FullSearchOptimizer : public SingleValuedNonLinearOptimizer
00044 {
00045 public:
00047 typedef FullSearchOptimizer Self;
00048 typedef SingleValuedNonLinearOptimizer Superclass;
00049 typedef SmartPointer<Self> Pointer;
00050 typedef SmartPointer<const Self> ConstPointer;
00051
00053 itkNewMacro(Self);
00054
00056 itkTypeMacro( FullSearchOptimizer, SingleValuedNonLinearOptimizer );
00057
00059 typedef enum {
00060 FullRangeSearched,
00061 MetricError
00062 } StopConditionType;
00063
00064
00065 typedef Superclass::ParametersType ParametersType;
00066 typedef Superclass::CostFunctionType CostFunctionType;
00067 typedef Superclass::CostFunctionPointer CostFunctionPointer;
00068 typedef Superclass::MeasureType MeasureType;
00069
00070 typedef ParametersType::ValueType ParameterValueType;
00071 typedef ParameterValueType RangeValueType;
00072 typedef FixedArray<RangeValueType, 3> RangeType;
00073 typedef MapContainer<unsigned int, RangeType> SearchSpaceType;
00074 typedef SearchSpaceType::Pointer SearchSpacePointer;
00075 typedef SearchSpaceType::ConstIterator SearchSpaceIteratorType;
00076
00079 typedef Array<ParameterValueType> SearchSpacePointType;
00080
00083 typedef Array<long> SearchSpaceIndexType;
00084
00086 typedef Array<unsigned long> SearchSpaceSizeType;
00087
00088
00092 itkGetConstMacro( Maximize, bool );
00093 itkSetMacro( Maximize, bool );
00094 itkBooleanMacro( Maximize );
00095 bool GetMinimize( ) const
00096 { return !m_Maximize; }
00097 void SetMinimize(bool v)
00098 { this->SetMaximize(!v); }
00099 void MinimizeOn()
00100 { this->MaximizeOff(); }
00101 void MinimizeOff()
00102 { this->MaximizeOn(); }
00103
00118 virtual void UpdateCurrentPosition(void);
00119
00123 virtual void StartOptimization( void );
00124
00128 virtual void ResumeOptimization( void );
00129
00133 virtual void StopOptimization( void );
00134
00145 itkSetObjectMacro( SearchSpace, SearchSpaceType );
00146 itkGetObjectMacro( SearchSpace, SearchSpaceType);
00147
00149 virtual void AddSearchDimension( unsigned int param_nr,
00150 RangeValueType minimum, RangeValueType maximum, RangeValueType step );
00151 virtual void RemoveSearchDimension( unsigned int param_nr );
00152
00154 virtual unsigned long GetNumberOfIterations(void);
00155
00157 virtual unsigned int GetNumberOfSearchSpaceDimensions(void);
00158
00160 virtual const SearchSpaceSizeType & GetSearchSpaceSize(void);
00161
00163 virtual ParametersType PointToPosition(const SearchSpacePointType & point);
00164 virtual ParametersType IndexToPosition(const SearchSpaceIndexType & index);
00165
00167 virtual SearchSpacePointType IndexToPoint(const SearchSpaceIndexType & index);
00168
00170 itkGetConstMacro( CurrentIteration, unsigned long );
00171
00173 itkGetConstReferenceMacro( CurrentPointInSearchSpace, SearchSpacePointType );
00174 itkGetConstReferenceMacro( CurrentIndexInSearchSpace, SearchSpaceIndexType );
00175
00177 itkGetConstReferenceMacro( BestPointInSearchSpace, SearchSpacePointType );
00178 itkGetConstReferenceMacro( BestIndexInSearchSpace, SearchSpaceIndexType );
00179
00181 itkGetConstMacro( Value, double );
00182
00184 itkGetConstMacro( BestValue, double );
00185
00187 itkGetConstMacro( StopCondition, StopConditionType );
00188
00189
00190 protected:
00191 FullSearchOptimizer();
00192 virtual ~FullSearchOptimizer() {};
00193
00194
00195
00196 bool m_Maximize;
00197 bool m_Stop;
00198 double m_Value;
00199 double m_BestValue;
00200 StopConditionType m_StopCondition;
00201
00202 SearchSpacePointer m_SearchSpace;
00203 SearchSpacePointType m_CurrentPointInSearchSpace;
00204 SearchSpaceIndexType m_CurrentIndexInSearchSpace;
00205 SearchSpacePointType m_BestPointInSearchSpace;
00206 SearchSpaceIndexType m_BestIndexInSearchSpace;
00207 SearchSpaceSizeType m_SearchSpaceSize;
00208 unsigned int m_NumberOfSearchSpaceDimensions;
00209
00210 unsigned long m_LastSearchSpaceChanges;
00211 virtual void ProcessSearchSpaceChanges(void);
00212
00213 private:
00214 FullSearchOptimizer(const Self&);
00215 void operator=(const Self&);
00216
00217 unsigned long m_CurrentIteration;
00218
00219 };
00220
00221 }
00222
00223
00224 #endif
00225