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: 2009-03-04 15:23:48 $
00007   Version:   $Revision: 1.10 $
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 
00116   typedef Histogram< float, 1 >                   HistogramType;
00117   typedef typename HistogramType::Pointer         HistogramPointer;
00118   typedef typename HistogramType::ConstPointer    HistogramConstPointer;
00119 
00121   typedef Array< double >  ParametersType;
00122 
00125   typedef Array< double >  CenterType;
00126 
00128   typedef double RadiusType;
00129 
00131   typedef Array< double >   MeanType;
00132 
00133 
00135   typedef double StandardDeviationType;
00136 
00138   virtual void SetInputSample(const TInputSample* sample);
00139   const TInputSample* GetInputSample() const;
00141 
00143   virtual unsigned int GetNumberOfParameters() const = 0;
00144 
00146   virtual void SetParameters(const ParametersType &parameters);
00147   ParametersType* GetParameters()
00148     { return m_Parameters; }
00150 
00153   void SetUseExpectedHistogram(bool flag);
00154 
00156   void SetHistogramNumberOfBins(int numberOfBins);
00157   int GetHistogramNumberOfBins()
00158     { return m_HistogramNumberOfBins; }
00160 
00164   void SetHistogramUseEquiProbableBins(bool flag);
00165   bool GetHistogramUseEquiProbableBins()
00166   { return m_HistogramUseEquiProbableBins; }
00168 
00170   void SetHistogramBinOverlap(double overlap);
00171   double GetHistogramBinOverlap()
00172     { return m_HistogramBinOverlap; }
00174 
00177   void SetHistogramExtent(double extent);
00178   double GetHistogramExtent()
00179     { return m_HistogramExtent; }
00181 
00183   virtual CenterType* GetCenter() = 0;
00184 
00186   virtual RadiusType* GetRadius() = 0;
00187 
00189   virtual MeanType* GetMean() = 0;
00190 
00192   virtual RadiusType* GetStandardDeviation() = 0;
00193 
00195   virtual void CreateHistograms();
00196 
00198   virtual void Resample();
00199 
00201   ResampledSampleType* GetResampledSample()
00202     { return m_Resampler->GetOutput(); }
00203 
00205   virtual unsigned int GetResampledSampleSize();
00206 
00208   virtual void CalculateProjectionAxes() = 0;
00209 
00212   virtual void Project(int projectionAxisIndex);
00213 
00216   virtual void UpdateExpectedHistogram();
00217 
00219   double* GetTotalObservedScale()
00220     { return &m_TotalObservedScale; } 
00221 
00223   virtual double GetCumulativeProbability(double x) 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 

Generated at Mon Jul 12 2010 18:25:04 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000