00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSingleValuedCostFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007-03-22 21:39:38 $ 00007 Version: $Revision: 1.9 $ 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 __itkSingleValuedCostFunction_h 00018 #define __itkSingleValuedCostFunction_h 00019 00020 #include "itkCostFunction.h" 00021 #include "itkArray.h" 00022 #include "itkObjectFactory.h" 00023 #include "itkNumericTraits.h" 00024 00025 00026 namespace itk 00027 { 00028 00035 class ITK_EXPORT SingleValuedCostFunction : 00036 public CostFunction 00037 { 00038 public: 00040 typedef SingleValuedCostFunction Self; 00041 typedef CostFunction Superclass; 00042 typedef SmartPointer<Self> Pointer; 00043 typedef SmartPointer<const Self> ConstPointer; 00044 00046 itkTypeMacro( SingleValuedCostFunction, CostFunction ); 00047 00050 typedef double MeasureType; 00051 00054 typedef Array<double> DerivativeType; 00055 00058 typedef Superclass::ParametersType ParametersType; 00059 00062 virtual MeasureType GetValue( const ParametersType & parameters ) const = 0; 00063 00066 virtual void GetDerivative( const ParametersType & parameters, 00067 DerivativeType & derivative ) const = 0; 00068 00071 virtual void GetValueAndDerivative( const ParametersType & parameters, 00072 MeasureType & value, 00073 DerivativeType & derivative ) const 00074 { 00075 value = this->GetValue( parameters ); 00076 this->GetDerivative( parameters, derivative ); 00077 } 00079 00080 protected: 00081 SingleValuedCostFunction() {}; 00082 virtual ~SingleValuedCostFunction() {}; 00083 00084 private: 00085 SingleValuedCostFunction(const Self&); //purposely not implemented 00086 void operator=(const Self&); //purposely not implemented 00087 00088 }; 00089 00090 } // end namespace itk 00091 00092 #endif 00093