1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkLogLikelihoodGoodnessOfFitFunction.h,v $
Language: C++
Date: $Date: 2009-03-04 15:23:56 $
Version: $Revision: 1.6 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkLogLikelihoodGoodnessOfFitFunction_h
#define __itkLogLikelihoodGoodnessOfFitFunction_h
#include "itkGoodnessOfFitFunctionBase.h"
namespace itk {
namespace Statistics {
/** \class LogLikelihoodGoodnessOfFitFunction
* \brief calculates loglikelihood ratio statistics
*
* This function needs an expected histogram in addition to the observed
* histogram.
*
* The statistics is
* \f$ \sum^{k}_{i=1}x_{i}\log(x_{i}/n\pi_{0i})\f$
*
* where \f$ x_{i} \f$ is the observed frequency of the \f$i\f$th bin, and
* \f$n\pi_{0i}\f$ is the expected frequency.
*
*
* \sa GoodnessOfFitFunctionBase, GoodnessOfFitMixtureModelCostFunction
*/
template< class TInputHistogram >
class LogLikelihoodGoodnessOfFitFunction
: public GoodnessOfFitFunctionBase< TInputHistogram >
{
public:
/** Standard class typedefs */
typedef LogLikelihoodGoodnessOfFitFunction Self;
typedef GoodnessOfFitFunctionBase< TInputHistogram > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Run-time type information (and related methods). */
itkTypeMacro(LogLikelihoodGoodnessOfFitFunction,
GoodnessOfFitFunctionBase);
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** typedefs from InputHistogram */
itkStaticConstMacro(MeasurementVectorSize, unsigned int,
TInputHistogram::MeasurementVectorSize);
typedef typename TInputHistogram::MeasurementType MeasurementType;
typedef typename TInputHistogram::MeasurementVectorType MeasurementVectorType;
protected:
LogLikelihoodGoodnessOfFitFunction();
virtual ~LogLikelihoodGoodnessOfFitFunction(){};
/** calculates the loglikelihood ratio statistics */
virtual void GenerateData();
private:
bool m_Initialized;
}; // end of class
} // end of namespace Statistics
} // end of namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkLogLikelihoodGoodnessOfFitFunction.txx"
#endif
#endif
|