go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkFullSearchOptimizer.h
Go to the documentation of this file.
00001 /*======================================================================
00002 
00003   This file is part of the elastix software.
00004 
00005   Copyright (c) University Medical Center Utrecht. All rights reserved.
00006   See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
00007   details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE. See the above copyright notices for more information.
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     /* Typedefs inherited from superclass */
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; // = double
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     //void PrintSelf(std::ostream& os, Indent indent) const;
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&); //purposely not implemented
00215     void operator=(const Self&); //purposely not implemented
00216 
00217     unsigned long                 m_CurrentIteration;
00218 
00219   }; // end class
00220 
00221 } // end namespace itk
00222 
00223 
00224 #endif
00225 


Generated on 24-05-2012 for elastix by doxygen 1.7.6.1 elastix logo