00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGoodnessOfFitMixtureModelCostFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:45 $ 00007 Version: $Revision: 1.5 $ 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 __itkGoodnessOfFitMixtureModelCostFunction_h 00018 #define __itkGoodnessOfFitMixtureModelCostFunction_h 00019 00020 #include "itkSingleValuedCostFunction.h" 00021 #include "itkHistogram.h" 00022 #include "itkGoodnessOfFitComponentBase.h" 00023 #include "itkGoodnessOfFitFunctionBase.h" 00024 #include "itkFunctionBase.h" 00025 00026 namespace itk{ 00027 namespace Statistics{ 00028 00074 template< class TInputSample > 00075 class ITK_EXPORT GoodnessOfFitMixtureModelCostFunction 00076 : public SingleValuedCostFunction 00077 { 00078 public: 00080 typedef GoodnessOfFitMixtureModelCostFunction Self; 00081 typedef SingleValuedCostFunction Superclass; 00082 typedef SmartPointer< Self > Pointer; 00083 typedef SmartPointer< const Self > ConstPointer; 00084 00086 itkTypeMacro(GoodnessOfFitMixtureModelCostFunction, SingleValuedCostFunction) ; 00087 00089 itkNewMacro(Self) ; 00090 00091 typedef TInputSample InputSampleType ; 00092 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00093 TInputSample::MeasurementVectorSize) ; 00094 typedef typename TInputSample::MeasurementType MeasurementType ; 00095 typedef typename TInputSample::MeasurementVectorType MeasurementVectorType ; 00096 00099 typedef SingleValuedCostFunction::ParametersType ParamtersType ; 00100 00103 typedef SingleValuedCostFunction::MeasureType MeasureType ; 00104 00105 typedef GoodnessOfFitComponentBase< TInputSample > ComponentType ; 00106 typedef std::vector< ComponentType* > ComponentVectorType ; 00107 00108 typedef GoodnessOfFitFunctionBase< typename ComponentType::HistogramType > 00109 FunctionType ; 00110 00112 void AddComponent(ComponentType* component) ; 00113 00115 void SetFunction(FunctionType* core) ; 00116 00117 FunctionType* GetFunction() 00118 { return m_Function ; } 00119 00120 virtual unsigned int GetNumberOfParameters() const ; 00121 00124 virtual MeasureType GetValue( const ParametersType & parameters ) const ; 00125 00128 virtual void GetDerivative( const ParametersType &, 00129 DerivativeType & ) const 00130 { /* not implemented */ } 00131 00132 protected: 00133 GoodnessOfFitMixtureModelCostFunction() ; 00134 virtual ~GoodnessOfFitMixtureModelCostFunction() ; 00135 virtual void PrintSelf(std::ostream& os, Indent indent) const ; 00136 00137 private: 00139 ComponentVectorType m_Components ; 00140 FunctionType* m_Function ; 00141 } ; // end of class 00142 00143 } // end of namespace Statistics 00144 } // end of namespace itk 00145 00146 #ifndef ITK_MANUAL_INSTANTIATION 00147 #include "itkGoodnessOfFitMixtureModelCostFunction.txx" 00148 #endif 00149 00150 #endif 00151