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 __itkGaussianMembershipFunction_h 00019 #define __itkGaussianMembershipFunction_h 00020 00021 #include "itkMatrix.h" 00022 #include "itkMembershipFunctionBase.h" 00023 00024 namespace itk 00025 { 00026 namespace Statistics 00027 { 00054 template< class TMeasurementVector > 00055 class ITK_EXPORT GaussianMembershipFunction: 00056 public MembershipFunctionBase< TMeasurementVector > 00057 { 00058 public: 00060 typedef GaussianMembershipFunction Self; 00061 typedef MembershipFunctionBase< TMeasurementVector > Superclass; 00062 typedef SmartPointer< Self > Pointer; 00063 typedef SmartPointer< const Self > ConstPointer; 00064 00066 itkTypeMacro(GaussianMembershipFunction, MembershipFunction); 00067 itkNewMacro(Self); 00069 00071 typedef typename Superclass::Pointer MembershipFunctionPointer; 00072 00074 typedef TMeasurementVector MeasurementVectorType; 00075 00077 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00078 00081 typedef typename itk::NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType; 00082 typedef MeasurementVectorRealType MeanVectorType; 00083 00085 typedef VariableSizeMatrix< double > CovarianceMatrixType; 00086 00089 void SetMean(const MeanVectorType & mean); 00090 00093 itkGetConstReferenceMacro(Mean, MeanVectorType); 00094 00099 void SetCovariance(const CovarianceMatrixType & cov); 00100 00101 /* Get the covariance matrix. Covariance matrix is a 00102 VariableSizeMatrix of doubles. */ 00103 itkGetConstReferenceMacro(Covariance, CovarianceMatrixType); 00104 00105 /* Get the inverse covariance matrix. Covariance matrix is a 00106 VariableSizeMatrix of doubles. */ 00107 itkGetConstReferenceMacro(InverseCovariance, CovarianceMatrixType); 00108 00110 double Evaluate(const MeasurementVectorType & measurement) const; 00111 00115 virtual typename LightObject::Pointer InternalClone() const; 00116 00117 protected: 00118 GaussianMembershipFunction(void); 00119 virtual ~GaussianMembershipFunction(void) {} 00120 void PrintSelf(std::ostream & os, Indent indent) const; 00121 00122 private: 00123 GaussianMembershipFunction(const Self &); //purposely not implemented 00124 void operator=(const Self &); //purposely not implemented 00125 00126 MeanVectorType m_Mean; // mean 00127 CovarianceMatrixType m_Covariance; // covariance matrix 00128 00129 // inverse covariance matrix. automatically calculated 00130 // when covariace matirx is set. 00131 CovarianceMatrixType m_InverseCovariance; 00132 00133 // pre_factor (normalization term). automatically calculated 00134 // when covariace matirx is set. 00135 double m_PreFactor; 00136 00138 bool m_CovarianceNonsingular; 00139 }; 00140 } // end of namespace Statistics 00141 } // end namespace itk 00142 00143 #ifndef ITK_MANUAL_INSTANTIATION 00144 #include "itkGaussianMembershipFunction.hxx" 00145 #endif 00146 00147 #endif 00148