OTB  9.0.0
Orfeo Toolbox
otbPolarimetricSynthesisFunctor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbPolarimetricSynthesisFunctor_h
22 #define otbPolarimetricSynthesisFunctor_h
23 
24 #include "otbMath.h"
25 #include <complex>
26 #include "itkFixedArray.h"
27 
28 namespace otb
29 {
30 namespace Functor
31 {
44 template <class TInput1, class TInput2, class TInput3, class TInput4, class TOutput>
46 {
47 public:
49  typedef typename std::complex<double> ComplexType;
50  typedef typename itk::FixedArray<ComplexType, 2> ComplexArrayType;
51 
54  {
55  m_Ei = ei;
56  }
57 
60  {
61  m_Er = er;
62  }
63 
66  {
67  m_Ei.Fill(1);
68  m_Er.Fill(1);
69  }
70 
73  {
74  }
75  inline TOutput operator()(const TInput1& Shh, const TInput2& Shv, const TInput3& Svh, const TInput4& Svv)
76  {
77  ComplexType tmp;
78  double scalar;
80 
81  tmp = std::conj(m_Er[0]) * (m_Ei[0] * static_cast<ComplexType>(Shh) + m_Ei[1] * static_cast<ComplexType>(Shv)) +
82  std::conj(m_Er[1]) * (m_Ei[0] * static_cast<ComplexType>(Svh) + m_Ei[1] * static_cast<ComplexType>(Svv));
83 
84  scalar = static_cast<double>(std::abs(tmp)) * static_cast<double>(std::abs(tmp));
85 
86  return (static_cast<TOutput>(scalar));
87  }
88 
89 private:
92 
95 };
96 
97 } // namespace Functor
98 } // namespace otb
99 
100 #endif
otb::Functor::PolarimetricSynthesisFunctor::operator()
TOutput operator()(const TInput1 &Shh, const TInput2 &Shv, const TInput3 &Svh, const TInput4 &Svv)
Definition: otbPolarimetricSynthesisFunctor.h:75
otbMath.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::PolarimetricSynthesisFunctor
Calculate the polarimetric synthesis.
Definition: otbPolarimetricSynthesisFunctor.h:45
otb::Functor::PolarimetricSynthesisFunctor::SetEi
void SetEi(ComplexArrayType ei)
Definition: otbPolarimetricSynthesisFunctor.h:53
otb::Functor::PolarimetricSynthesisFunctor::SetEr
void SetEr(ComplexArrayType er)
Definition: otbPolarimetricSynthesisFunctor.h:59
otb::Functor::PolarimetricSynthesisFunctor::ComplexType
std::complex< double > ComplexType
Definition: otbPolarimetricSynthesisFunctor.h:49
otb::Functor::PolarimetricSynthesisFunctor::m_Ei
ComplexArrayType m_Ei
Definition: otbPolarimetricSynthesisFunctor.h:91
otb::Functor::PolarimetricSynthesisFunctor::~PolarimetricSynthesisFunctor
virtual ~PolarimetricSynthesisFunctor()
Definition: otbPolarimetricSynthesisFunctor.h:72
otb::Functor::PolarimetricSynthesisFunctor::PolarimetricSynthesisFunctor
PolarimetricSynthesisFunctor()
Definition: otbPolarimetricSynthesisFunctor.h:65
otb::Functor::PolarimetricSynthesisFunctor::m_Er
ComplexArrayType m_Er
Definition: otbPolarimetricSynthesisFunctor.h:94
otb::Functor::PolarimetricSynthesisFunctor::ComplexArrayType
itk::FixedArray< ComplexType, 2 > ComplexArrayType
Definition: otbPolarimetricSynthesisFunctor.h:50