Orfeo Toolbox  4.2
otbKullbackLeiblerProfileImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12  Some parts of this code are covered by the GET copyright.
13  See GETCopyright.txt for details.
14 
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notices for more information.
19 
20 =========================================================================*/
21 #ifndef __otbKullbackLeiblerProfileImageFilter_h
22 #define __otbKullbackLeiblerProfileImageFilter_h
23 
24 #include <vector>
25 
26 #include "itkArray.h"
27 #include "itkArray2D.h"
29 
31 
32 namespace otb
33 {
34 
39 template <class TInput>
41 {
42 public:
44  typedef std::vector<CumulantType> CumulantSet;
45  typedef CumulantSet::iterator Iterator;
46 
47  CumulantsForEdgeworthProfile (const TInput& input, std::vector<itk::Array2D<int> >& mask);
49 
50  // Kullback-Leibler Profile
51  template <class TInput2>
53  // Kullback-Leibler divergence at a given scale
54  double KL_profile(const CumulantType& cumulants1, const CumulantType& cumulants2);
55  // Access to data
57  {
58  return this->fCum[i];
59  }
60  // Check data availability
61  inline bool IsDataAvailable() const
62  {
63  return this->fDataAvailable;
64  }
65 
66  // debug
67  int m_debug;
68 
69 protected:
70 
71  // Momentum Estimation from encapsulated neighborhood
72  int MakeSumAndMoments(const TInput& input, std::vector<itk::Array2D<int> >& mask);
73  // momentum estimation from the smaller window
74  int InitSumAndMoments(const TInput& input, itk::Array2D<int>& mask);
75  //
76  int ReInitSumAndMoments(const TInput& input, itk::Array2D<int>& mask, int level);
77  // transformation moment -> cumulants (for Edgeworth)
78  int MakeCumulants();
79 
80  // Internal variables
81  double fSum0, fSum1, fSum2, fSum3, fSum4;
84 
86 
87 private:
88  CumulantsForEdgeworthProfile (); // Not implemented
89  CumulantsForEdgeworthProfile (const TInput& input); // Not implemented
90 
91 };
92 
93 namespace Functor
94 {
99 template<class TInput1, class TInput2, class TOutput>
101 {
102 public:
105  // Gives the radius min and max of neighborhood
106  void SetRadius(const unsigned char& min, const unsigned char& max);
107  unsigned char GetRadiusMin(void);
108  unsigned char GetRadiusMax(void);
109  // Gives the size of the profile
111  {
112  return m_mask.size();
113  }
114  // functor
115  TOutput operator ()(const TInput1& it1, const TInput2& it2);
116 protected:
117  // Make the set of masks to play the increase in window size
118  void MakeMultiscaleProfile();
119  // Internal attributes
120  unsigned char m_RadiusMin;
121  unsigned char m_RadiusMax;
122  std::vector<itk::Array2D<int> > m_mask;
123 };
124 } // Functor
125 
156 template <class TInputImage1, class TInputImage2, class TOutputImage>
159  TInputImage1, TInputImage2, TOutputImage,
160  Functor::KullbackLeiblerProfile<
161  typename itk::ConstNeighborhoodIterator<TInputImage1>,
162  typename itk::ConstNeighborhoodIterator<TInputImage2>,
163  typename TOutputImage::PixelType> >
164 {
165 public:
168  typedef /*typename*/ BinaryFunctorNeighborhoodVectorImageFilter<
169  TInputImage1, TInputImage2, TOutputImage,
173  typename TOutputImage::PixelType>
177 
179  itkNewMacro(Self);
180 
181 protected:
184 
185 private:
186  KullbackLeiblerProfileImageFilter(const Self &); //purposely not implemented
187  void operator =(const Self&); //purposely not implemented
188 
189 };
190 
191 } // namespace otb
192 
193 #ifndef OTB_MANUAL_INSTANTIATION
195 #endif
196 
197 #endif

Generated at Sat Aug 30 2014 16:09:17 for Orfeo Toolbox with doxygen 1.8.3.1