00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGoodnessOfFitFunctionBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 15:23:49 $ 00007 Version: $Revision: 1.7 $ 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 00060 typedef typename TInputHistogram::MeasurementType MeasurementType; 00061 typedef typename TInputHistogram::MeasurementVectorType MeasurementVectorType; 00062 typedef TInputHistogram InputHistogramType; 00063 00065 void SetObservedHistogram(InputHistogramType* histogram); 00066 00068 InputHistogramType* GetObservedHistogram() 00069 { return m_ObservedHistogram; } 00070 00072 void SetExpectedHistogram(InputHistogramType* histogram); 00073 00075 InputHistogramType* GetExpectedHistogram() 00076 { return m_ExpectedHistogram; } 00077 00081 itkGetMacro(UseExpectedHistogram, bool); 00082 00083 void SetTotalObservedScale(double* scale) 00084 { 00085 if ( m_TotalObservedScale != scale ) 00086 { 00087 m_TotalObservedScale = scale; 00088 this->Modified(); 00089 } 00090 } 00091 00092 typedef double OutputType; 00093 00094 OutputType& GetOutput() 00095 { return m_Output; } 00096 00097 protected: 00098 GoodnessOfFitFunctionBase(); 00099 virtual ~GoodnessOfFitFunctionBase(){}; 00100 void PrintSelf(std::ostream& os, Indent indent) const; 00101 00102 itkSetMacro(UseExpectedHistogram, bool); 00103 00104 virtual void GenerateData() {} 00105 00106 itkGetConstReferenceMacro(Epsilon,float); 00107 itkGetConstReferenceMacro(LogEpsilon,float); 00108 00109 private: 00110 float m_Epsilon; 00111 float m_LogEpsilon; 00112 00113 bool m_UseExpectedHistogram; 00114 00115 InputHistogramType* m_ObservedHistogram; 00116 InputHistogramType* m_ExpectedHistogram; 00117 00118 double* m_TotalObservedScale; 00119 OutputType m_Output; 00120 00121 }; // end of class 00122 00123 } // end of namespace Statistics 00124 } // end of namespace itk 00125 00126 #ifndef ITK_MANUAL_INSTANTIATION 00127 #include "itkGoodnessOfFitFunctionBase.txx" 00128 #endif 00129 00130 #endif 00131