ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkSingleValuedCostFunction.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkSingleValuedCostFunction_h
00019 #define __itkSingleValuedCostFunction_h
00020 
00021 #include "itkCostFunction.h"
00022 #include "itkNumericTraits.h"
00023 
00024 namespace itk
00025 {
00033 class ITK_EXPORT SingleValuedCostFunction:
00034   public CostFunction
00035 {
00036 public:
00038   typedef SingleValuedCostFunction   Self;
00039   typedef CostFunction               Superclass;
00040   typedef SmartPointer< Self >       Pointer;
00041   typedef SmartPointer< const Self > ConstPointer;
00042 
00044   itkTypeMacro(SingleValuedCostFunction, CostFunction);
00045 
00048   typedef double MeasureType;
00049 
00052   typedef Superclass::ParametersType      ParametersType;
00053   typedef Superclass::ParametersValueType ParametersValueType;
00054 
00057   typedef Array< ParametersValueType > DerivativeType;
00058 
00061   virtual MeasureType GetValue(const ParametersType & parameters) const = 0;
00062 
00065   virtual void GetDerivative(const ParametersType & parameters,
00066                              DerivativeType & derivative) const = 0;
00067 
00070   virtual void GetValueAndDerivative(const ParametersType & parameters,
00071                                      MeasureType & value,
00072                                      DerivativeType & derivative) const
00073   {
00074     value = this->GetValue(parameters);
00075     this->GetDerivative(parameters, derivative);
00076   }
00078 
00079 protected:
00080   SingleValuedCostFunction() {}
00081   virtual ~SingleValuedCostFunction() {}
00082 private:
00083   SingleValuedCostFunction(const Self &); //purposely not implemented
00084   void operator=(const Self &);           //purposely not implemented
00085 };
00086 } // end namespace itk
00087 
00088 #endif
00089