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;
00139 
00141   virtual unsigned int GetNumberOfParameters() const = 0 ;
00142 
00144   virtual void SetParameters(const ParametersType &parameters) ;
00145   ParametersType* GetParameters()
00146   { return m_Parameters ; }
00147 
00150   void SetUseExpectedHistogram(bool flag) ;
00151 
00153   void SetHistogramNumberOfBins(int numberOfBins) ;
00154   int GetHistogramNumberOfBins()
00155   { return m_HistogramNumberOfBins ; }
00156 
00160   void SetHistogramUseEquiProbableBins(bool flag) ;
00161   bool GetHistogramUseEquiProbableBins()
00162   { return m_HistogramUseEquiProbableBins ; }
00163 
00165   void SetHistogramBinOverlap(double overlap) ;
00166   double GetHistogramBinOverlap()
00167   { return m_HistogramBinOverlap ; }
00168 
00171   void SetHistogramExtent(double extent) ;
00172   double GetHistogramExtent()
00173   { return m_HistogramExtent ; }
00174 
00176   virtual CenterType* GetCenter() = 0 ;
00177   
00179   virtual RadiusType* GetRadius() = 0 ;
00180 
00182   virtual MeanType* GetMean() = 0 ;
00183 
00185   virtual RadiusType* GetStandardDeviation() = 0 ;
00186 
00188   virtual void CreateHistograms() ;
00189 
00191   virtual void Resample() ;
00192 
00194   ResampledSampleType* GetResampledSample()
00195   { return m_Resampler->GetOutput() ; }
00196 
00198   virtual unsigned int GetResampledSampleSize() ;
00199 
00201   virtual void CalculateProjectionAxes() = 0 ;
00202 
00205   virtual void Project(int projectionAxisIndex) ;
00206 
00209   virtual void UpdateExpectedHistogram() ;
00210 
00212   double* GetTotalObservedScale()
00213   { return &m_TotalObservedScale ; } 
00214 
00216   virtual double GetCumulativeProbability(double x) 
00217     const = 0 ;
00218 
00221   virtual double GetProbabilityDensity(MeasurementVectorType &measurements) 
00222     const = 0 ;
00223 
00225   virtual double GetProportion() const
00226   { return m_Proportion ; }
00227 
00229   HistogramType *  GetObservedHistogram();
00230   
00232   HistogramType *  GetExpectedHistogram();
00233 
00235   virtual void PrintParameters(std::ostream &os) const = 0 ;
00236 
00238   virtual ParametersType GetFullParameters() const = 0 ;
00239 
00244   itkGetConstMacro( MeasurementVectorSize, MeasurementVectorSizeType );
00245   
00246 protected:
00247   GoodnessOfFitComponentBase() ;
00248   virtual ~GoodnessOfFitComponentBase() ;
00249   virtual void PrintSelf(std::ostream& os, Indent indent) const ;
00250 
00252   typedef NeighborhoodSampler< TInputSample > ResamplerType ;
00253 
00255   typedef SampleToHistogramProjectionFilter< ResampledSampleType, float > 
00256   ProjectorType ;
00257 
00258   
00262   typedef VariableSizeMatrix< double > ProjectionAxisArrayType;
00263 
00264 
00265   ProjectionAxisArrayType* GetProjectionAxes()
00266   { return &m_ProjectionAxes ; }
00267 
00269   virtual void CreateEquiRangeBins() ;
00270 
00273   virtual void CreateEquiProbableBins() ;
00274 
00275 private:
00277   MeasurementVectorSizeType m_MeasurementVectorSize;
00278 
00279   const TInputSample* m_InputSample ;
00280   ParametersType m_Parameters ;
00281 
00283   typename ResamplerType::Pointer m_Resampler ;
00284   typename ProjectorType::Pointer m_Projector ;
00285 
00286   ProjectionAxisArrayType m_ProjectionAxes ;
00287 
00289   unsigned int m_HistogramNumberOfBins ;
00290   bool m_HistogramUseEquiProbableBins ;
00291   double m_HistogramExtent ;
00292   double m_HistogramBinOverlap ;
00293   bool m_HistogramSizeChanged ;
00294 
00296   double m_TotalObservedScale ;
00297   double m_HistogramMean ;
00298   double m_HistogramStandardDeviation  ;
00299 
00300   double m_Proportion ;
00301 
00303   HistogramPointer m_ObservedHistogram ;
00304   HistogramPointer m_ExpectedHistogram ;
00305   bool m_UseExpectedHistogram ;
00306 
00307 } ; // end of class
00308 
00309 } // end of namespace Statistics 
00310 } // end of namespace itk
00311 
00312 #ifndef ITK_MANUAL_INSTANTIATION
00313 #include "itkGoodnessOfFitComponentBase.txx"
00314 #endif
00315 
00316 #endif
00317 

Generated at Wed May 24 23:12:29 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000