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: 2005/07/26 15:54:56 $
00007   Version:   $Revision: 1.9 $
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 __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 #include "vnl/vnl_matrix.h"
00027 #include "itkVariableSizeMatrix.h"
00028 
00029 namespace itk{ 
00030 namespace Statistics{
00031 
00088 template< class TInputSample >
00089 class GoodnessOfFitComponentBase 
00090   : public Object 
00091 {
00092 public:
00094   typedef GoodnessOfFitComponentBase Self;
00095   typedef Object Superclass;
00096   typedef SmartPointer< Self > Pointer;
00097   typedef SmartPointer< const Self > ConstPointer;
00098 
00100   itkTypeMacro(GoodnessOfFitComponentBase, Object) ;
00101 
00103   typedef TInputSample InputSampleType ;
00104 
00105   
00107   typedef typename TInputSample::MeasurementType MeasurementType ;
00108   typedef typename TInputSample::MeasurementVectorType MeasurementVectorType ;
00109   typedef typename TInputSample::MeasurementVectorSizeType MeasurementVectorSizeType;
00110 
00112   typedef Subsample< TInputSample > ResampledSampleType ;
00113 
00115   typedef Histogram< float, 1 > HistogramType ;
00116   typedef typename HistogramType::Pointer         HistogramPointer ;
00117   typedef typename HistogramType::ConstPointer    HistogramConstPointer ;
00118 
00120   typedef Array< double >  ParametersType ;
00121 
00124   typedef Array< double >  CenterType;
00125 
00127   typedef double RadiusType ;
00128 
00130   typedef Array< double >   MeanType ;
00131 
00132 
00134   typedef double StandardDeviationType ;
00135 
00137   virtual void SetInputSample(const TInputSample* sample) ;
00138   const TInputSample* GetInputSample() const;
00140 
00142   virtual unsigned int GetNumberOfParameters() const = 0 ;
00143 
00145   virtual void SetParameters(const ParametersType &parameters) ;
00146   ParametersType* GetParameters()
00147   { return m_Parameters ; }
00149 
00152   void SetUseExpectedHistogram(bool flag) ;
00153 
00155   void SetHistogramNumberOfBins(int numberOfBins) ;
00156   int GetHistogramNumberOfBins()
00157   { return m_HistogramNumberOfBins ; }
00159 
00163   void SetHistogramUseEquiProbableBins(bool flag) ;
00164   bool GetHistogramUseEquiProbableBins()
00165   { return m_HistogramUseEquiProbableBins ; }
00167 
00169   void SetHistogramBinOverlap(double overlap) ;
00170   double GetHistogramBinOverlap()
00171   { return m_HistogramBinOverlap ; }
00173 
00176   void SetHistogramExtent(double extent) ;
00177   double GetHistogramExtent()
00178   { return m_HistogramExtent ; }
00180 
00182   virtual CenterType* GetCenter() = 0 ;
00183 
00185   virtual RadiusType* GetRadius() = 0 ;
00186 
00188   virtual MeanType* GetMean() = 0 ;
00189 
00191   virtual RadiusType* GetStandardDeviation() = 0 ;
00192 
00194   virtual void CreateHistograms() ;
00195 
00197   virtual void Resample() ;
00198 
00200   ResampledSampleType* GetResampledSample()
00201   { return m_Resampler->GetOutput() ; }
00202 
00204   virtual unsigned int GetResampledSampleSize() ;
00205 
00207   virtual void CalculateProjectionAxes() = 0 ;
00208 
00211   virtual void Project(int projectionAxisIndex) ;
00212 
00215   virtual void UpdateExpectedHistogram() ;
00216 
00218   double* GetTotalObservedScale()
00219   { return &m_TotalObservedScale ; } 
00220 
00222   virtual double GetCumulativeProbability(double x) 
00223     const = 0 ;
00224 
00227   virtual double GetProbabilityDensity(MeasurementVectorType &measurements) 
00228     const = 0 ;
00229 
00231   virtual double GetProportion() const
00232   { return m_Proportion ; }
00233 
00235   HistogramType *  GetObservedHistogram();
00236 
00238   HistogramType *  GetExpectedHistogram();
00239 
00241   virtual void PrintParameters(std::ostream &os) const = 0 ;
00242 
00244   virtual ParametersType GetFullParameters() const = 0 ;
00245 
00250   itkGetConstMacro( MeasurementVectorSize, MeasurementVectorSizeType );
00251 
00252 protected:
00253   GoodnessOfFitComponentBase() ;
00254   virtual ~GoodnessOfFitComponentBase() ;
00255   virtual void PrintSelf(std::ostream& os, Indent indent) const ;
00256 
00258   typedef NeighborhoodSampler< TInputSample > ResamplerType ;
00259 
00261   typedef SampleToHistogramProjectionFilter< ResampledSampleType, float > 
00262   ProjectorType ;
00263 
00264   
00268   typedef VariableSizeMatrix< double > ProjectionAxisArrayType;
00269 
00270 
00271   ProjectionAxisArrayType* GetProjectionAxes()
00272   { return &m_ProjectionAxes ; }
00273 
00275   virtual void CreateEquiRangeBins() ;
00276 
00279   virtual void CreateEquiProbableBins() ;
00280 
00281 private:
00283   MeasurementVectorSizeType m_MeasurementVectorSize;
00284 
00285   const TInputSample* m_InputSample ;
00286   ParametersType m_Parameters ;
00287 
00289   typename ResamplerType::Pointer m_Resampler ;
00290   typename ProjectorType::Pointer m_Projector ;
00291 
00292   ProjectionAxisArrayType m_ProjectionAxes ;
00293 
00295   unsigned int m_HistogramNumberOfBins ;
00296   bool m_HistogramUseEquiProbableBins ;
00297   double m_HistogramExtent ;
00298   double m_HistogramBinOverlap ;
00299   bool m_HistogramSizeChanged ;
00300 
00302   double m_TotalObservedScale ;
00303   double m_HistogramMean ;
00304   double m_HistogramStandardDeviation  ;
00305 
00306   double m_Proportion ;
00307 
00309   HistogramPointer m_ObservedHistogram ;
00310   HistogramPointer m_ExpectedHistogram ;
00311   bool m_UseExpectedHistogram ;
00312 
00313 } ; // end of class
00314 
00315 } // end of namespace Statistics 
00316 } // end of namespace itk
00317 
00318 #ifndef ITK_MANUAL_INSTANTIATION
00319 #include "itkGoodnessOfFitComponentBase.txx"
00320 #endif
00321 
00322 #endif
00323 
00324 

Generated at Mon Mar 12 00:28:57 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000