Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkSingleValuedVnlCostFunctionAdaptor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSingleValuedVnlCostFunctionAdaptor.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/02/26 00:48:55 $
00007   Version:   $Revision: 1.1 $
00008 
00009   Copyright (c) 2002 Insight 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 __itkSingleValuedVnlCostFunctionAdaptor_h
00018 #define __itkSingleValuedVnlCostFunctionAdaptor_h
00019 
00020 #include "itkSingleValuedCostFunction.h"
00021 #include "vnl/vnl_cost_function.h"
00022 
00023 
00024 namespace itk
00025 {
00026   
00036 class SingleValuedVnlCostFunctionAdaptor : 
00037           public vnl_cost_function
00038 {
00039 public:
00040 
00042   typedef   vnl_vector<double>     InternalParametersType;
00043 
00045   typedef   double                 InternalMeasureType;
00046 
00048   typedef   vnl_vector<double>     InternalDerivativeType;
00049 
00051   typedef SingleValuedCostFunction::ParametersType ParametersType;
00052 
00054   typedef SingleValuedCostFunction::DerivativeType DerivativeType;
00055 
00056 
00058   SingleValuedVnlCostFunctionAdaptor(unsigned int spaceDimension);
00059 
00061   void SetCostFunction( SingleValuedCostFunction * costFunction )
00062           { m_CostFunction = costFunction; }
00063     
00065   const SingleValuedCostFunction * GetCostFunction( void ) const
00066           { return m_CostFunction; }
00067     
00069   virtual InternalMeasureType f( const InternalParametersType & inparameters );
00070     
00072   virtual void gradf(const InternalParametersType   & inparameters,
00073                            InternalDerivativeType   & gradient );
00074     
00076   virtual void compute(const InternalParametersType   & x,
00077                              InternalMeasureType      * f, 
00078                              InternalDerivativeType   * g   );
00079 
00081   static void ConvertInternalToExternalParameters( 
00082                             const InternalParametersType & input,
00083                                   ParametersType         & output );
00084 
00086   static void ConvertExternalToInternalParameters(
00087                             const  ParametersType         & input,
00088                                    InternalParametersType & output );
00089     
00091   void ConvertExternalToInternalGradient(
00092                             const DerivativeType         & input,
00093                                   InternalDerivativeType & output );
00094 
00095 private:
00096 
00097   SingleValuedCostFunction::Pointer   m_CostFunction;
00098 
00099 };  // end of Class CostFunction
00100 
00101     
00102 } // end namespace itk
00103 
00104 
00105 #endif
00106 
00107 
00108 

Generated at Wed Mar 12 01:13:10 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000