Orfeo Toolbox  3.16
itkHistogramToProbabilityImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkHistogramToProbabilityImageFilter.h,v $
5  Language: C++
6  Date: $Date: 2009-04-01 14:36:37 $
7  Version: $Revision: 1.8 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkHistogramToProbabilityImageFilter_h
18 #define __itkHistogramToProbabilityImageFilter_h
19 
21 
22 namespace itk
23 {
24 
46 namespace Function {
47 template< class TInput, class TOutput=float >
49 {
50 public:
51 
52  //Probability function = Number of occurances in each bin /
53  // Total Number of occurances.
54  //
55  // Returns pixels of float..
56  typedef TOutput OutputPixelType;
57 
58 
60  m_TotalFrequency(1) {}
61 
63 
64  inline OutputPixelType operator()( const TInput & A ) const
65  {
66  return static_cast<OutputPixelType>( static_cast<OutputPixelType>(A) /
67  static_cast<OutputPixelType>(m_TotalFrequency) );
68  }
69 
70  void SetTotalFrequency( unsigned long n )
71  {
72  m_TotalFrequency = n;
73  }
74 
75  unsigned long GetTotalFrequency( ) const
76  {
77  return m_TotalFrequency;
78  }
79 
80 private:
81  unsigned long m_TotalFrequency;
82 };
83 }
84 
85 template <class THistogram, class TOutputPixel=float >
87  public HistogramToImageFilter< THistogram,
88  Function::HistogramProbabilityFunction< unsigned long, TOutputPixel > >
89 {
90 public:
91 
94 
96  typedef HistogramToImageFilter< THistogram,
99 
102 
105 
107  itkNewMacro(Self);
108 
109 protected:
112 
113 private:
114  HistogramToProbabilityImageFilter(const Self&); //purposely not implemented
115  void operator=(const Self&); //purposely not implemented
116 
117 };
118 
119 } // end namespace itk
120 
121 #endif

Generated at Sat May 18 2013 23:42:48 for Orfeo Toolbox with doxygen 1.8.3.1