00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGoodnessOfFitMixtureModelCostFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 15:23:49 $ 00007 Version: $Revision: 1.7 $ 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 00135 protected: 00136 GoodnessOfFitMixtureModelCostFunction(); 00137 virtual ~GoodnessOfFitMixtureModelCostFunction(); 00138 virtual void PrintSelf(std::ostream& os, Indent indent) const; 00139 00140 private: 00142 ComponentVectorType m_Components; 00143 FunctionType* m_Function; 00144 }; // end of class 00145 00146 } // end of namespace Statistics 00147 } // end of namespace itk 00148 00149 #ifndef ITK_MANUAL_INSTANTIATION 00150 #include "itkGoodnessOfFitMixtureModelCostFunction.txx" 00151 #endif 00152 00153 #endif 00154