00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkMultipleValuedNonLinearVnlOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007-03-22 21:39:37 $ 00007 Version: $Revision: 1.25 $ 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() 00068 { 00069 this->SetUseCostFunctionGradient( true ); 00070 } 00071 void UseCostFunctionGradientOff() 00072 { 00073 this->SetUseCostFunctionGradient( false ); 00074 } 00075 bool GetUseCostFunctionGradient() const; 00077 00084 itkGetConstReferenceMacro(CachedValue, MeasureType); 00085 itkGetConstReferenceMacro(CachedDerivative, DerivativeType); 00086 itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType); 00088 00089 protected: 00090 MultipleValuedNonLinearVnlOptimizer(); 00091 virtual ~MultipleValuedNonLinearVnlOptimizer(); 00092 00093 void PrintSelf(std::ostream& os, Indent indent) const; 00094 00095 typedef MultipleValuedVnlCostFunctionAdaptor CostFunctionAdaptorType; 00096 00097 void SetCostFunctionAdaptor( CostFunctionAdaptorType * adaptor ); 00098 const CostFunctionAdaptorType * GetCostFunctionAdaptor( void ) const; 00099 CostFunctionAdaptorType * GetCostFunctionAdaptor( void ); 00100 00103 CostFunctionAdaptorType * GetNonConstCostFunctionAdaptor( void ) const; 00104 00109 typedef ReceptorMemberCommand< Self > CommandType; 00110 00111 private: 00112 MultipleValuedNonLinearVnlOptimizer(const Self&); //purposely not implemented 00113 void operator=(const Self&); //purposely not implemented 00114 00116 void IterationReport( const EventObject & event ); 00117 00118 CostFunctionAdaptorType * m_CostFunctionAdaptor; 00119 bool m_UseGradient; 00120 00121 CommandType::Pointer m_Command; 00122 00123 mutable ParametersType m_CachedCurrentPosition; 00124 mutable MeasureType m_CachedValue; 00125 mutable DerivativeType m_CachedDerivative; 00126 00127 }; 00128 00129 } // end namespace itk 00130 00131 #endif 00132