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

itkPSquareQuantile.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkPSquareQuantile.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/01/15 19:38:56 $
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 __itkPSquareQuantile_h
00018 #define __itkPSquareQuantile_h
00019 
00020 namespace itk{ 
00021   namespace Statistics{
00022 
00042 template< class TData >
00043 class PSquareQuantile
00044 {
00045 public:
00046   typedef TData DataContainerType ;
00047   typedef typename DataContainerType::Pointer DataContainerPointer ;
00048   typedef typename DataContainerType::MeasurementType ValueType ;
00049   typedef typename DataContainerType::InstanceIdentifier InstanceIdentifier ;
00050 
00054   double operator() (DataContainerPointer data, long dimension, 
00055                      double p) ;
00056 
00057 protected:
00061   ValueType GetValue(InstanceIdentifier id) const
00062   {
00063     return m_Data->GetMeasurement(m_Dimension, id) ;
00064   }
00065   
00069   void SetValue(InstanceIdentifier id, ValueType value) 
00070   {
00071     m_Data->SetMeasurement(m_Dimension, id, value) ;
00072   }
00073 
00079   double ParabolicEstimate(InstanceIdentifier i, int direction) const
00080   {
00081     double estimate ;
00082     double p1 = double(direction) / double(n[i + 1] - n[i - 1]) ;
00083     double p2 = double(n[i] - n[i - 1] + direction) * double(q[i + 1] - q[i]) /
00084       double( n[i + 1] - n[i]) ;
00085     double p3 = double(n[i + 1] - n[i] - direction) * double(q[i] - q[i - 1]) /
00086       double(n[i] - n[i - 1]) ;
00087 
00088     estimate = q[i] + p1 * (p2 + p3) ;
00089     return estimate ;
00090   }
00091 
00095   double LinearEstimate(InstanceIdentifier i, int direction)
00096   {
00097     return q[i] + direction *
00098       (q[i + direction] - q[i]) / (n[i + direction] - n[i]) ;
00099   }
00100 
00101   void PrintSelf(std::ostream& os, Indent indent) const;
00102 
00103 private:
00104   DataContainerPointer m_Data ;
00105   long m_Dimension ;
00106 
00107   std::vector< double > q ; // marker heights
00108   std::vector< long > n ; // marker positions
00109   std::vector< double > np ; // desired marker position
00110   std::vector< double > dn ; // increment in desired marker position
00111 } ;
00112 
00113   } // end of namespace Statistics
00114 } // end of namespace itk
00115 
00116 #ifndef ITK_MANUAL_INSTANTIATION
00117 #include "itkPSquareQuantile.txx"
00118 #endif
00119 
00120 #endif

Generated at Wed Mar 12 01:13:09 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000