00001 /*========================================================================= 00002 00003 Program: F.R.E.E. - flexible registration evaluation engine 00004 Version: v.1.0.0 00005 Date: $Date: 2006/09/01 12:00:00 $ 00006 Module: $RCSfile: freItkSingleValuedCostFunctionWrapper.cxx,v $ 00007 Language: C++ 00008 00009 00010 00011 Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics, 00012 Institute for Medical Biometry and Informatics, University of Heidelberg, 00013 Germany). All rights reserved. 00014 See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm 00015 for details. 00016 00017 This software is distributed WITHOUT ANY WARRANTY; without even 00018 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00019 PURPOSE. See the above copyright notices for more information. 00020 00021 =========================================================================*/ 00022 #include "freItkSingleValuedCostFunctionWrapper.h" 00023 00024 namespace FREE 00025 { 00026 00027 ItkSingleValuedCostFunctionWrapper::ItkSingleValuedCostFunctionWrapper() 00028 { 00029 m_WrappedCostFunction = 0; 00030 }; 00031 00032 ItkSingleValuedCostFunctionWrapper::~ItkSingleValuedCostFunctionWrapper() 00033 { 00034 }; 00035 00036 unsigned int 00037 ItkSingleValuedCostFunctionWrapper:: 00038 GetNumberOfParameters(void) const 00039 { 00040 if (m_WrappedCostFunction.IsNull()) throwExceptionMacro("Wrapped metric is undefined (NULL). Cannot get number of parameters."); 00041 return m_WrappedCostFunction->GetNumberOfParameters(); 00042 }; 00043 00044 ItkSingleValuedCostFunctionWrapper::MeasureType 00045 ItkSingleValuedCostFunctionWrapper:: 00046 GetValue( const ParametersType & parameters ) const 00047 { 00048 if (m_WrappedCostFunction.IsNull()) throwExceptionMacro("Wrapped metric is undefined (NULL). Cannot get metric value."); 00049 return m_WrappedCostFunction->GetValue(parameters); 00050 }; 00051 00052 void 00053 ItkSingleValuedCostFunctionWrapper:: 00054 GetDerivative( const ParametersType & parameters, 00055 DerivativeType & derivative ) const 00056 { 00057 if (m_WrappedCostFunction.IsNull()) throwExceptionMacro("Wrapped metric is undefined (NULL). Cannot get derivative."); 00058 m_WrappedCostFunction->GetDerivative(parameters, derivative); 00059 } 00060 00061 void 00062 ItkSingleValuedCostFunctionWrapper:: 00063 GetValueAndDerivative(const ParametersType & parameters, 00064 MeasureType & value, DerivativeType & derivative) const 00065 { 00066 if (m_WrappedCostFunction.IsNull()) throwExceptionMacro("Wrapped metric is undefined (NULL). Cannot get metric value and derevative."); 00067 m_WrappedCostFunction->GetValueAndDerivative(parameters, value, derivative); 00068 } 00069 00070 } // end namespace FREE
1.5.3 written by Dimitri van Heesch,
© 1997-2000