00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSingleValuedCostFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:38 $ 00007 Version: $Revision: 1.8 $ 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 }; 00078 00079 protected: 00080 SingleValuedCostFunction() {}; 00081 virtual ~SingleValuedCostFunction() {}; 00082 00083 private: 00084 SingleValuedCostFunction(const Self&); //purposely not implemented 00085 void operator=(const Self&); //purposely not implemented 00086 00087 }; 00088 00089 00090 00091 00092 00093 00094 } // end namespace itk 00095 00096 00097 #endif 00098 00099 00100