Orfeo Toolbox  4.0
otbSinclairToCoherencyMatrixFunctor.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 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbSinclairToCoherencyMatrixFunctor_h
19 #define __otbSinclairToCoherencyMatrixFunctor_h
20 
21 #include "vcl_complex.h"
22 
23 namespace otb
24 {
25 namespace Functor
26 {
58 template <class TInput1, class TInput2, class TInput3,
59  class TInput4, class TOutput>
61 {
62 public:
64  typedef double RealType;
65  typedef std::complex <RealType> ComplexType;
66  typedef typename TOutput::ValueType OutputValueType;
67  inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv,
68  const TInput3& Svh, const TInput4& Svv)
69  {
70  TOutput result;
71 
72  result.SetSize(m_NumberOfComponentsPerPixel);
73 
74  const ComplexType S_hh = static_cast<ComplexType>(Shh);
75  const ComplexType S_hv = static_cast<ComplexType>(Shv);
76  const ComplexType S_vh = static_cast<ComplexType>(Svh);
77  const ComplexType S_vv = static_cast<ComplexType>(Svv);
78 
79  const ComplexType HHPlusVV = S_hh + S_vv;
80  const ComplexType HHMinusVV = S_hh - S_vv;
81  const ComplexType HVPlusVH = S_hv + S_vh;
82  const ComplexType jHVMinusVH = (S_hv - S_vh) * ComplexType(0., 1.);
83 
84  result[0] = static_cast<OutputValueType>( std::norm(HHPlusVV) );
85  result[1] = static_cast<OutputValueType>( HHPlusVV * vcl_conj(HHMinusVV) );
86  result[2] = static_cast<OutputValueType>( HHPlusVV * vcl_conj(HVPlusVH) );
87  result[3] = static_cast<OutputValueType>( HHPlusVV * vcl_conj(jHVMinusVH) );
88  result[4] = static_cast<OutputValueType>( std::norm(HHMinusVV) );
89  result[5] = static_cast<OutputValueType>( HHMinusVV * vcl_conj(HVPlusVH) );
90  result[6] = static_cast<OutputValueType>( HHMinusVV * vcl_conj(jHVMinusVH) );
91  result[7] = static_cast<OutputValueType>( std::norm(HVPlusVH) );
92  result[8] = static_cast<OutputValueType>( HVPlusVH * vcl_conj(jHVMinusVH) );
93  result[9] = static_cast<OutputValueType>( std::norm(jHVMinusVH) );
94 
95  result /= 2.0;
96 
97  return (result);
98  }
99 
101  {
103  }
104 
107 
110 
111 protected:
112 
113 
114 private:
115  //itkStaticConstMacro(NumberOfComponentsPerPixel, unsigned int, 10);
116  static const unsigned int m_NumberOfComponentsPerPixel = 10;
117 };
118 
119 } // namespace Functor
120 } // namespace otb
121 
122 #endif

Generated at Sat Mar 8 2014 16:18:28 for Orfeo Toolbox with doxygen 1.8.3.1