Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkGoodnessOfFitComponentBase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGoodnessOfFitComponentBase.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/21 20:26:42 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) 2002 Insight 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 __itkGoodnessOfFitComponentBase_h
00018 #define __itkGoodnessOfFitComponentBase_h
00019 
00020 #include "itkObject.h"
00021 #include "itkArray.h"
00022 #include "itkHistogram.h"
00023 #include "itkFunctionBase.h"
00024 #include "itkNeighborhoodSampler.h"
00025 #include "itkSampleToHistogramProjectionFilter.h"
00026 
00027 namespace itk{ 
00028 namespace Statistics{
00029 
00079 template< class TInputSample >
00080 class GoodnessOfFitComponentBase 
00081   : public Object 
00082 {
00083 public:
00085   typedef GoodnessOfFitComponentBase Self;
00086   typedef Object Superclass;
00087   typedef SmartPointer< Self > Pointer;
00088   typedef SmartPointer< const Self > ConstPointer;
00089   
00091   itkTypeMacro(GoodnessOfFitComponentBase, Object) ;
00092   
00093   typedef TInputSample InputSampleType ;
00094   itkStaticConstMacro(MeasurementVectorSize, unsigned int,
00095                       TInputSample::MeasurementVectorSize) ;
00096   typedef typename TInputSample::MeasurementType MeasurementType ;
00097   typedef typename TInputSample::MeasurementVectorType MeasurementVectorType ;
00098 
00100   typedef Subsample< TInputSample > ResampledSampleType ;
00101 
00102 
00104   typedef Histogram< float, 1 > HistogramType ;
00105 
00106   typedef Array< double > ParametersType ;
00107 
00108   typedef FixedArray< double, 
00109                       itkGetStaticConstMacro(MeasurementVectorSize) > CenterType ;
00110   typedef Vector< double, itkGetStaticConstMacro(MeasurementVectorSize) > MeanType ;
00111   typedef double RadiusType ;
00112   typedef double StandardDeviationType ;
00113 
00114   virtual void SetInputSample(TInputSample* sample) ;
00115 
00116   TInputSample* GetInputSample() ;
00117 
00118   virtual unsigned int GetNumberOfParameters() const = 0 ;
00119 
00120   virtual void SetParameters(const ParametersType &parameters) ;
00121 
00122   ParametersType* GetParameters()
00123   { return m_Parameters ; }
00124 
00125   void SetUseExpectedHistogram(bool flag) ;
00126 
00127   void SetHistogramNumberOfBins(int numberOfBins) ;
00128 
00129   int GetHistogramNumberOfBins()
00130   { return m_HistogramNumberOfBins ; }
00131 
00132   void SetHistogramUseEquiProbableBins(bool flag) ;
00133 
00134   bool GetHistogramUseEquiProbableBins()
00135   { return m_HistogramUseEquiProbableBins ; }
00136 
00137   void SetHistogramBinOverlap(double overlap) ;
00138 
00139   double GetHistogramBinOverlap()
00140   { return m_HistogramBinOverlap ; }
00141 
00142   void SetHistogramExtent(double extent) ;
00143 
00144   double GetHistogramExtent()
00145   { return m_HistogramExtent ; }
00146 
00147   virtual CenterType* GetCenter() = 0 ;
00148   
00149   virtual RadiusType* GetRadius() = 0 ;
00150 
00151   virtual MeanType* GetMean() = 0 ;
00152 
00153   virtual RadiusType* GetStandardDeviation() = 0 ;
00154 
00155   virtual void CreateHistograms() ;
00156 
00157   virtual void Resample() ;
00158 
00159   ResampledSampleType* GetResampledSample()
00160   { return m_Resampler->GetOutput() ; }
00161 
00162   virtual unsigned int GetResampledSampleSize() ;
00163 
00164   virtual void CalculateProjectionAxes() = 0 ;
00165 
00166   virtual void Project(int projectionAxisIndex) ;
00167 
00168   virtual void UpdateExpectedHistogram() ;
00169 
00170   double* GetTotalObservedScale()
00171   { return &m_TotalObservedScale ; } 
00172 
00173   virtual double GetCumulativeProbability(double x) 
00174     const = 0 ;
00175 
00176   virtual double GetProbabilityDensity(MeasurementVectorType &measurements) 
00177     const = 0 ;
00178 
00179   virtual double GetProportion() const
00180   { return m_Proportion ; }
00181 
00183   HistogramType* GetObservedHistogram() ;
00184   
00185   HistogramType* GetExpectedHistogram() ;
00186 
00187   virtual void PrintParameters(std::ostream &os) const = 0 ;
00188 
00189   virtual ParametersType GetFullParameters() const = 0 ;
00190 
00191 protected:
00192   GoodnessOfFitComponentBase() ;
00193   virtual ~GoodnessOfFitComponentBase() ;
00194   virtual void PrintSelf(std::ostream& os, Indent indent) const ;
00195 
00197   typedef NeighborhoodSampler< TInputSample > ResamplerType ;
00198 
00200   typedef SampleToHistogramProjectionFilter< ResampledSampleType, float > 
00201   ProjectorType ;
00202 
00206   typedef FixedArray< double, 
00207                       itkGetStaticConstMacro(MeasurementVectorSize) > 
00208   ProjectionAxisType ;
00209   typedef FixedArray< ProjectionAxisType, 
00210                       itkGetStaticConstMacro(MeasurementVectorSize) > 
00211   ProjectionAxisArrayType;
00212 
00213   ProjectionAxisArrayType* GetProjectionAxes()
00214   { return &m_ProjectionAxes ; }
00215 
00216   virtual void CreateEquiRangeBins() ;
00217   virtual void CreateEquiProbableBins() ;
00218 
00219 private:
00220   TInputSample* m_InputSample ;
00221   ParametersType m_Parameters ;
00222 
00224   typename ResamplerType::Pointer m_Resampler ;
00225   typename ProjectorType::Pointer m_Projector ;
00226 
00227   ProjectionAxisArrayType m_ProjectionAxes ;
00228 
00230   unsigned int m_HistogramNumberOfBins ;
00231   bool m_HistogramUseEquiProbableBins ;
00232   double m_HistogramExtent ;
00233   double m_HistogramBinOverlap ;
00234   bool m_HistogramSizeChanged ;
00235 
00237   double m_TotalObservedScale ;
00238   double m_HistogramMean ;
00239   double m_HistogramStandardDeviation  ;
00240 
00241   double m_Proportion ;
00242 
00244   HistogramType::Pointer m_ObservedHistogram ;
00245   HistogramType::Pointer m_ExpectedHistogram ;
00246   bool m_UseExpectedHistogram ;
00247 
00248 } ; // end of class
00249 
00250 } // end of namespace Statistics 
00251 } // end of namespace itk
00252 
00253 #ifndef ITK_MANUAL_INSTANTIATION
00254 #include "itkGoodnessOfFitComponentBase.txx"
00255 #endif
00256 
00257 #endif
00258 

Generated at Fri May 21 01:14:49 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000