00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGoodnessOfFitMixtureModelCostFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/07/26 15:54:57 $ 00007 Version: $Revision: 1.6 $ 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 00079 template< class TInputSample > 00080 class ITK_EXPORT GoodnessOfFitMixtureModelCostFunction 00081 : public SingleValuedCostFunction 00082 { 00083 public: 00085 typedef GoodnessOfFitMixtureModelCostFunction Self; 00086 typedef SingleValuedCostFunction Superclass; 00087 typedef SmartPointer< Self > Pointer; 00088 typedef SmartPointer< const Self > ConstPointer; 00089 00091 itkTypeMacro(GoodnessOfFitMixtureModelCostFunction, SingleValuedCostFunction) ; 00092 00094 itkNewMacro(Self) ; 00095 00096 typedef TInputSample InputSampleType ; 00097 typedef typename TInputSample::MeasurementType MeasurementType ; 00098 typedef typename TInputSample::MeasurementVectorType MeasurementVectorType ; 00099 typedef typename TInputSample::MeasurementVectorSizeType MeasurementVectorSizeType; 00100 00103 typedef SingleValuedCostFunction::ParametersType ParamtersType ; 00104 00107 typedef SingleValuedCostFunction::MeasureType MeasureType ; 00108 00109 typedef GoodnessOfFitComponentBase< TInputSample > ComponentType ; 00110 typedef std::vector< ComponentType* > ComponentVectorType ; 00111 00112 typedef GoodnessOfFitFunctionBase< typename ComponentType::HistogramType > 00113 FunctionType ; 00114 00116 void AddComponent(ComponentType* component) ; 00117 00119 void SetFunction(FunctionType* core) ; 00120 00121 FunctionType* GetFunction() 00122 { return m_Function ; } 00123 00124 virtual unsigned int GetNumberOfParameters() const ; 00125 00128 virtual MeasureType GetValue( const ParametersType & parameters ) const ; 00129 00132 virtual void GetDerivative( const ParametersType &, 00133 DerivativeType & ) const 00134 { /* not implemented */ } 00135 00136 protected: 00137 GoodnessOfFitMixtureModelCostFunction() ; 00138 virtual ~GoodnessOfFitMixtureModelCostFunction() ; 00139 virtual void PrintSelf(std::ostream& os, Indent indent) const ; 00140 00141 private: 00143 ComponentVectorType m_Components ; 00144 FunctionType* m_Function ; 00145 } ; // end of class 00146 00147 } // end of namespace Statistics 00148 } // end of namespace itk 00149 00150 #ifndef ITK_MANUAL_INSTANTIATION 00151 #include "itkGoodnessOfFitMixtureModelCostFunction.txx" 00152 #endif 00153 00154 #endif 00155