ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkProbabilityDistribution_h 00019 #define __itkProbabilityDistribution_h 00020 00021 #include "itkIntTypes.h" 00022 #include "itkObject.h" 00023 #include "itkObjectFactory.h" 00024 #include "itkArray.h" 00025 00026 namespace itk 00027 { 00028 namespace Statistics 00029 { 00071 class ITK_EXPORT ProbabilityDistribution: 00072 public Object 00073 { 00074 public: 00076 typedef ProbabilityDistribution Self; 00077 typedef Object Superclass; 00078 typedef SmartPointer< Self > Pointer; 00079 typedef SmartPointer< const Self > ConstPointer; 00080 00082 itkTypeMacro(ProbabilityDistribution, Object); 00083 00085 typedef Array< double > ParametersType; 00086 00090 virtual SizeValueType GetNumberOfParameters() const = 0; 00091 00095 itkGetConstReferenceMacro(Parameters, ParametersType); 00096 00100 virtual void SetParameters(const ParametersType & params) 00101 { 00102 if ( ( params.GetSize() != m_Parameters.GetSize() ) 00103 || ( params != m_Parameters ) ) 00104 { 00105 m_Parameters = params; 00106 this->Modified(); 00107 } 00108 } 00110 00113 virtual double EvaluatePDF(double x) const = 0; 00114 00118 virtual double EvaluatePDF(double x, const ParametersType &) const = 0; 00119 00123 virtual double EvaluateCDF(double x) const = 0; 00124 00128 virtual double EvaluateCDF(double x, const ParametersType &) const = 0; 00129 00134 virtual double EvaluateInverseCDF(double p) const = 0; 00135 00140 virtual double EvaluateInverseCDF(double p, const ParametersType &) const = 0; 00141 00143 virtual bool HasMean() const = 0; 00144 00146 virtual bool HasVariance() const = 0; 00147 00150 virtual double GetMean() const = 0; 00151 00154 virtual double GetVariance() const = 0; 00155 00156 protected: 00157 ProbabilityDistribution(void) {} 00158 virtual ~ProbabilityDistribution(void) {} 00159 void PrintSelf(std::ostream & os, Indent indent) const 00160 { 00161 Superclass::PrintSelf(os, indent); 00162 os << indent << "Parameters: " << m_Parameters << std::endl; 00163 } 00164 00165 ParametersType m_Parameters; 00166 private: 00167 ProbabilityDistribution(const Self &); //purposely not implemented 00168 void operator=(const Self &); //purposely not implemented 00169 }; // end of class 00170 } // end of namespace Statistics 00171 } // end namespace itk 00172 00173 #endif 00174