00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMultipleValuedNonLinearVnlOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2006/05/12 12:58:27 $ 00007 Version: $Revision: 1.24 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkMultipleValuedNonLinearVnlOptimizer_h 00018 #define __itkMultipleValuedNonLinearVnlOptimizer_h 00019 00020 #include "itkMultipleValuedNonLinearOptimizer.h" 00021 #include "itkMultipleValuedVnlCostFunctionAdaptor.h" 00022 #include "itkCommand.h" 00023 00024 00025 namespace itk 00026 { 00027 00036 class ITK_EXPORT MultipleValuedNonLinearVnlOptimizer : 00037 public MultipleValuedNonLinearOptimizer 00038 { 00039 public: 00041 typedef MultipleValuedNonLinearVnlOptimizer Self; 00042 typedef MultipleValuedNonLinearOptimizer Superclass; 00043 typedef SmartPointer<Self> Pointer; 00044 typedef SmartPointer<const Self> ConstPointer; 00045 00047 itkTypeMacro( MultipleValuedNonLinearVnlOptimizer, 00048 MultipleValueNonLinearOptimizer ); 00049 00050 00053 typedef Superclass::ParametersType ParametersType; 00054 00061 virtual void SetCostFunction( MultipleValuedCostFunction * costFunction ) = 0; 00062 00066 void SetUseCostFunctionGradient(bool); 00067 void UseCostFunctionGradientOn() { this->SetUseCostFunctionGradient( true ); } 00068 void UseCostFunctionGradientOff() { this->SetUseCostFunctionGradient( false ); }; 00069 bool GetUseCostFunctionGradient() const; 00071 00077 itkGetConstReferenceMacro(CachedValue, MeasureType); 00078 itkGetConstReferenceMacro(CachedDerivative, DerivativeType); 00079 itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType); 00081 00082 protected: 00083 MultipleValuedNonLinearVnlOptimizer(); 00084 virtual ~MultipleValuedNonLinearVnlOptimizer(); 00085 00086 void PrintSelf(std::ostream& os, Indent indent) const; 00087 00088 typedef MultipleValuedVnlCostFunctionAdaptor CostFunctionAdaptorType; 00089 00090 void SetCostFunctionAdaptor( CostFunctionAdaptorType * adaptor ); 00091 const CostFunctionAdaptorType * GetCostFunctionAdaptor( void ) const; 00092 CostFunctionAdaptorType * GetCostFunctionAdaptor( void ); 00093 00096 CostFunctionAdaptorType * GetNonConstCostFunctionAdaptor( void ) const; 00097 00102 typedef ReceptorMemberCommand< Self > CommandType; 00103 00104 private: 00105 MultipleValuedNonLinearVnlOptimizer(const Self&); //purposely not implemented 00106 void operator=(const Self&); //purposely not implemented 00107 00109 void IterationReport( const EventObject & event ); 00110 00111 CostFunctionAdaptorType * m_CostFunctionAdaptor; 00112 bool m_UseGradient; 00113 00114 CommandType::Pointer m_Command; 00115 00116 mutable ParametersType m_CachedCurrentPosition; 00117 mutable MeasureType m_CachedValue; 00118 mutable DerivativeType m_CachedDerivative; 00119 00120 }; 00121 00122 } // end namespace itk 00123 00124 00125 00126 00127 #endif 00128 00129 00130 00131