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

itkMultipleValuedVnlCostFunctionAdaptor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMultipleValuedVnlCostFunctionAdaptor.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/20 19:36:47 $
00007   Version:   $Revision: 1.2 $
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 __itkMultipleValuedVnlCostFunctionAdaptor_h
00018 #define __itkMultipleValuedVnlCostFunctionAdaptor_h
00019 
00020 #include "itkMultipleValuedCostFunction.h"
00021 #include "vnl/vnl_least_squares_function.h"
00022 
00023 
00024 namespace itk
00025 {
00026   
00036 class MultipleValuedVnlCostFunctionAdaptor : 
00037           public vnl_least_squares_function
00038 {
00039 public:
00040 
00042   typedef   vnl_vector<double>     InternalParametersType;
00043 
00045   typedef   vnl_vector<double>     InternalMeasureType;
00046 
00048   typedef   vnl_matrix<double>     InternalDerivativeType;
00049 
00051   typedef MultipleValuedCostFunction::MeasureType   MeasureType;
00052 
00054   typedef MultipleValuedCostFunction::ParametersType ParametersType;
00055 
00057   typedef MultipleValuedCostFunction::DerivativeType DerivativeType;
00058 
00059 
00061   MultipleValuedVnlCostFunctionAdaptor( unsigned int spaceDimension,
00062                                         unsigned int numberOfValues );
00063 
00065   void SetCostFunction( MultipleValuedCostFunction * costFunction )
00066           { m_CostFunction = costFunction; }
00067     
00069   const MultipleValuedCostFunction * GetCostFunction( void ) const
00070           { return m_CostFunction; }
00071     
00073   virtual void f( const InternalParametersType & inparameters,
00074                         InternalMeasureType    & measures      );
00075     
00077   virtual void gradf(const InternalParametersType   & inparameters,
00078                            InternalDerivativeType   & gradient );
00079     
00081   virtual void compute(const InternalParametersType   & x,
00082                              InternalMeasureType      * f, 
00083                              InternalDerivativeType   * g   );
00084 
00086   static void ConvertInternalToExternalParameters( 
00087                             const InternalParametersType & input,
00088                                   ParametersType         & output );
00089 
00091   static void ConvertExternalToInternalParameters(
00092                             const  ParametersType         & input,
00093                                    InternalParametersType & output );
00094     
00096   void ConvertExternalToInternalGradient(
00097                             const DerivativeType         & input,
00098                                   InternalDerivativeType & output );
00099 
00101   void ConvertExternalToInternalMeasures(
00102                             const MeasureType         & input,
00103                                   InternalMeasureType & output );
00104 
00108   void SetUseGradient(bool);
00109   void UseGradientOn()  { this->SetUseGradient( true  ); };
00110   void UseGradientOff() { this->SetUseGradient( false ); };
00111   bool GetUseGradient() const;
00112 
00113 private:
00114 
00115   MultipleValuedCostFunction::Pointer   m_CostFunction;
00116 
00117 };  // end of Class CostFunction
00118 
00119     
00120 } // end namespace itk
00121 
00122 
00123 #endif
00124 
00125 
00126 

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