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 
00122     virtual void StartOptimization( void );
00123 
00126     virtual void    ResumeOptimization( void );
00127 
00130     virtual void    StopOptimization( void );
00131 
00142     itkSetObjectMacro( SearchSpace, SearchSpaceType );
00143     itkGetObjectMacro( SearchSpace, SearchSpaceType);
00144 
00146     virtual void AddSearchDimension(unsigned int param_nr, RangeValueType minimum, RangeValueType maximum, RangeValueType step);
00147     virtual void RemoveSearchDimension(unsigned int param_nr);
00148 
00150     virtual const unsigned long GetNumberOfIterations(void);
00151 
00153     virtual const unsigned int GetNumberOfSearchSpaceDimensions(void);
00154 
00156     virtual const SearchSpaceSizeType & GetSearchSpaceSize(void);
00157 
00159     virtual ParametersType PointToPosition(const SearchSpacePointType & point);
00160     virtual ParametersType IndexToPosition(const SearchSpaceIndexType & index);
00161 
00163     virtual SearchSpacePointType IndexToPoint(const SearchSpaceIndexType & index);
00164 
00166     itkGetConstMacro( CurrentIteration, unsigned long );
00167 
00169     itkGetConstReferenceMacro( CurrentPointInSearchSpace, SearchSpacePointType );
00170     itkGetConstReferenceMacro( CurrentIndexInSearchSpace, SearchSpaceIndexType );
00171 
00173     itkGetConstReferenceMacro( BestPointInSearchSpace, SearchSpacePointType );
00174     itkGetConstReferenceMacro( BestIndexInSearchSpace, SearchSpaceIndexType );
00175 
00177     itkGetConstMacro( Value, double );
00178 
00180     itkGetConstMacro( BestValue, double );
00181 
00183     itkGetConstMacro( StopCondition, StopConditionType );
00184 
00185 
00186   protected:
00187     FullSearchOptimizer();
00188     virtual ~FullSearchOptimizer() {};
00189 
00190     //void PrintSelf(std::ostream& os, Indent indent) const;
00191 
00192     bool                          m_Maximize;
00193     bool                          m_Stop;
00194     double                        m_Value;
00195     double                        m_BestValue;
00196     StopConditionType             m_StopCondition;
00197 
00198     SearchSpacePointer            m_SearchSpace;
00199     SearchSpacePointType          m_CurrentPointInSearchSpace;
00200     SearchSpaceIndexType          m_CurrentIndexInSearchSpace;
00201     SearchSpacePointType          m_BestPointInSearchSpace;
00202     SearchSpaceIndexType          m_BestIndexInSearchSpace;
00203     SearchSpaceSizeType           m_SearchSpaceSize;
00204     unsigned int                  m_NumberOfSearchSpaceDimensions;
00205 
00206     unsigned long                 m_LastSearchSpaceChanges;
00207     virtual void ProcessSearchSpaceChanges(void);
00208 
00209   private:
00210     FullSearchOptimizer(const Self&); //purposely not implemented
00211     void operator=(const Self&); //purposely not implemented
00212 
00213     unsigned long                 m_CurrentIteration;
00214 
00215   }; // end class
00216 
00217 } // end namespace itk
00218 
00219 
00220 #endif
00221 
00222 
00223 


Generated on 11-05-2011 for elastix by doxygen 1.7.4 elastix logo