00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGoodnessOfFitFunctionBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2004/11/04 20:40:41 $ 00007 Version: $Revision: 1.6 $ 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 __itkGoodnessOfFitFunctionBase_h 00018 #define __itkGoodnessOfFitFunctionBase_h 00019 00020 #include "itkSampleAlgorithmBase.h" 00021 #include "itkFunctionBase.h" 00022 #include "itkGoodnessOfFitComponentBase.h" 00023 00024 namespace itk{ 00025 namespace Statistics{ 00026 00038 template< class TInputHistogram > 00039 class GoodnessOfFitFunctionBase 00040 : public SampleAlgorithmBase< TInputHistogram > 00041 { 00042 public: 00044 typedef GoodnessOfFitFunctionBase Self; 00045 typedef SampleAlgorithmBase< TInputHistogram > Superclass; 00046 typedef SmartPointer< Self > Pointer; 00047 typedef SmartPointer< const Self > ConstPointer; 00048 00050 itkTypeMacro(GoodnessOfFitFunctionBase, 00051 SampleAlgorithimBase) ; 00052 00054 itkNewMacro(Self) ; 00055 00057 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00058 TInputHistogram::MeasurementVectorSize) ; 00059 typedef typename TInputHistogram::MeasurementType MeasurementType ; 00060 typedef typename TInputHistogram::MeasurementVectorType MeasurementVectorType ; 00061 typedef TInputHistogram InputHistogramType ; 00062 00064 void SetObservedHistogram(InputHistogramType* histogram) ; 00065 00067 InputHistogramType* GetObservedHistogram() 00068 { return m_ObservedHistogram ; } 00069 00071 void SetExpectedHistogram(InputHistogramType* histogram) ; 00072 00074 InputHistogramType* GetExpectedHistogram() 00075 { return m_ExpectedHistogram ; } 00076 00080 itkGetMacro(UseExpectedHistogram, bool) ; 00081 00082 void SetTotalObservedScale(double* scale) 00083 { 00084 if ( m_TotalObservedScale != scale ) 00085 { 00086 m_TotalObservedScale = scale ; 00087 this->Modified() ; 00088 } 00089 } 00090 00091 typedef double OutputType ; 00092 00093 OutputType& GetOutput() 00094 { return m_Output ; } 00095 00096 protected: 00097 GoodnessOfFitFunctionBase() ; 00098 virtual ~GoodnessOfFitFunctionBase(){} ; 00099 void PrintSelf(std::ostream& os, Indent indent) const; 00100 00101 itkSetMacro(UseExpectedHistogram, bool) ; 00102 00103 virtual void GenerateData() {} 00104 00105 itkGetConstReferenceMacro(Epsilon,float); 00106 itkGetConstReferenceMacro(LogEpsilon,float); 00107 00108 private: 00109 float m_Epsilon ; 00110 float m_LogEpsilon ; 00111 00112 bool m_UseExpectedHistogram ; 00113 00114 InputHistogramType* m_ObservedHistogram ; 00115 InputHistogramType* m_ExpectedHistogram ; 00116 00117 double* m_TotalObservedScale ; 00118 OutputType m_Output ; 00119 00120 } ; // end of class 00121 00122 } // end of namespace Statistics 00123 } // end of namespace itk 00124 00125 #ifndef ITK_MANUAL_INSTANTIATION 00126 #include "itkGoodnessOfFitFunctionBase.txx" 00127 #endif 00128 00129 #endif 00130