00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkProbabilityDistribution.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 15:24:04 $ 00007 Version: $Revision: 1.2 $ 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 __itkProbabilityDistribution_h 00018 #define __itkProbabilityDistribution_h 00019 00020 #include "itkObject.h" 00021 #include "itkObjectFactory.h" 00022 #include "itkArray.h" 00023 00024 namespace itk { 00025 namespace Statistics { 00026 00067 class ITK_EXPORT ProbabilityDistribution : 00068 public Object 00069 { 00070 public: 00072 typedef ProbabilityDistribution Self; 00073 typedef Object Superclass; 00074 typedef SmartPointer<Self> Pointer; 00075 typedef SmartPointer<const Self> ConstPointer; 00076 00078 itkTypeMacro(ProbabilityDistribution, Object); 00079 00081 typedef Array< double > ParametersType; 00082 00086 virtual unsigned long GetNumberOfParameters() const = 0; 00087 00091 itkGetConstReferenceMacro(Parameters, ParametersType); 00092 00096 virtual void SetParameters(const ParametersType& params) 00097 { 00098 if (params != m_Parameters) 00099 { 00100 m_Parameters = params; 00101 this->Modified(); 00102 } 00103 } 00105 00108 virtual double EvaluatePDF(double x) const = 0; 00109 00113 virtual double EvaluatePDF(double x, const ParametersType&) const = 0; 00114 00118 virtual double EvaluateCDF(double x) const = 0; 00119 00123 virtual double EvaluateCDF(double x, const ParametersType&) const = 0; 00124 00129 virtual double EvaluateInverseCDF(double p) const = 0; 00130 00135 virtual double EvaluateInverseCDF(double p, const ParametersType&) const = 0; 00136 00138 virtual bool HasMean() const = 0; 00139 00141 virtual bool HasVariance() const = 0; 00142 00145 virtual double GetMean() const = 0; 00146 00149 virtual double GetVariance() const = 0; 00150 00151 protected: 00152 ProbabilityDistribution(void) {} 00153 virtual ~ProbabilityDistribution(void) {} 00154 void PrintSelf(std::ostream& os, Indent indent) const 00155 { 00156 Superclass::PrintSelf(os,indent); 00157 os << indent << "Parameters: " << m_Parameters << std::endl; 00158 } 00159 00160 ParametersType m_Parameters; 00161 00162 private: 00163 ProbabilityDistribution(const Self&); //purposely not implemented 00164 void operator=(const Self&); //purposely not implemented 00165 00166 }; // end of class 00167 00168 } // end of namespace Statistics 00169 } // end namespace itk 00170 00171 #endif 00172