Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkHistogramToProbabilityImageFilter_h
00018 #define __itkHistogramToProbabilityImageFilter_h
00019
00020 #include "itkHistogramToImageFilter.h"
00021
00022 namespace itk
00023 {
00024
00046 namespace Function {
00047 template< class TInput, class TOutput=float >
00048 class HistogramProbabilityFunction
00049 {
00050 public:
00051
00052
00053
00054
00055
00056 typedef TOutput OutputPixelType;
00057
00058
00059 HistogramProbabilityFunction():
00060 m_TotalFrequency(1) {}
00061
00062 ~HistogramProbabilityFunction() {};
00063
00064 inline OutputPixelType operator()( const TInput & A ) const
00065 {
00066 return static_cast<OutputPixelType>( static_cast<OutputPixelType>(A) /
00067 static_cast<OutputPixelType>(m_TotalFrequency) );
00068 }
00069
00070 void SetTotalFrequency( unsigned long n )
00071 {
00072 m_TotalFrequency = n;
00073 }
00074
00075 unsigned long GetTotalFrequency( ) const
00076 {
00077 return m_TotalFrequency;
00078 }
00079
00080 private:
00081 unsigned long m_TotalFrequency;
00082 };
00083 }
00084
00085 template <class THistogram, unsigned int NDimensions, class TOutputPixel=float >
00086 class ITK_EXPORT HistogramToProbabilityImageFilter :
00087 public HistogramToImageFilter< THistogram, NDimensions,
00088 Function::HistogramProbabilityFunction< unsigned long, TOutputPixel > >
00089 {
00090 public:
00091
00093 typedef HistogramToProbabilityImageFilter Self;
00094
00096 typedef HistogramToImageFilter< THistogram, NDimensions,
00097 Function::HistogramProbabilityFunction< unsigned long, TOutputPixel> >
00098 Superclass;
00099
00100 typedef SmartPointer<Self> Pointer;
00101 typedef SmartPointer<const Self> ConstPointer;
00102
00104 itkTypeMacro( HistogramToProbabilityImageFilter, HistogramToImageFilter );
00105
00107 itkNewMacro(Self);
00108
00109 protected:
00110 HistogramToProbabilityImageFilter() {}
00111 virtual ~HistogramToProbabilityImageFilter() {}
00112
00113 private:
00114 HistogramToProbabilityImageFilter(const Self&);
00115 void operator=(const Self&);
00116
00117 };
00118
00119 }
00120
00121 #endif
00122