OTB  9.0.0
Orfeo Toolbox
otbReciprocalCoherencyToReciprocalMuellerImageFilter.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 
22 #ifndef otbReciprocalCoherencyToReciprocalMuellerImageFilter_h
23 #define otbReciprocalCoherencyToReciprocalMuellerImageFilter_h
24 
25 #include "otbFunctorImageFilter.h"
26 
27 namespace otb
28 {
29 
30 namespace Functor
31 {
32 
77 template <class TInput, class TOutput>
79 {
80 public:
81  typedef typename std::complex<double> ComplexType;
82  typedef typename TOutput::ValueType OutputValueType;
83 
84  inline void operator()(TOutput& result, const TInput& Coherency) const
85  {
86  const double T1 = static_cast<double>(Coherency[0].real());
87  const double T2 = static_cast<double>(Coherency[3].real());
88  const double T3 = static_cast<double>(Coherency[5].real());
89 
90  ComplexType VAL4 = static_cast<ComplexType>((Coherency[1] - Coherency[3]));
91  ComplexType VAL5 = static_cast<ComplexType>((Coherency[1] - Coherency[0]));
92  ComplexType VAL0 = static_cast<ComplexType>(Coherency[5]) + VAL5 - std::conj(VAL4);
93  ComplexType VAL1 = static_cast<ComplexType>(-Coherency[5]) + VAL5 - std::conj(VAL4);
94 
95  result[0] = 0.5 * (T1 + T2 + T3);
96  result[1] = static_cast<double>(Coherency[1].real() + Coherency[3].imag());
97  result[2] = static_cast<double>(Coherency[2].real());
98  result[3] = static_cast<double>(Coherency[4].imag());
99  result[4] = static_cast<double>(Coherency[1].real());
100  result[5] = 0.5 * (T1 + T2 - T3);
101  result[6] = static_cast<double>(Coherency[4].real());
102  result[7] = static_cast<double>(Coherency[2].imag());
103  result[8] = static_cast<double>(-Coherency[2].real());
104  result[9] = static_cast<double>(-Coherency[4].real());
105  result[10] = static_cast<double>(0.5 * VAL1.real());
106  result[11] = static_cast<double>(0.5 * VAL0.imag());
107  result[12] = static_cast<double>(Coherency[4].imag());
108  result[13] = static_cast<double>(Coherency[2].imag());
109  result[14] = static_cast<double>(0.5 * std::conj(VAL1).imag());
110  result[15] = static_cast<double>(0.5 * VAL0.real());
111  }
112 
113  constexpr size_t OutputSize(...) const
114  {
115  // Size of the reciprocal mueller matrix
116  return 16;
117  }
118 };
119 } // namespace Functor
120 
133 template <typename TInputImage, typename TOutputImage>
136 
137 } // end namespace otb
138 
139 #endif
otb::Functor::ReciprocalCoherencyToReciprocalMuellerFunctor::OutputSize
constexpr vcl_size_t OutputSize(...) const
Definition: otbReciprocalCoherencyToReciprocalMuellerImageFilter.h:113
otbFunctorImageFilter.h
otb::FunctorImageFilter
A generic functor filter templated by its functor.
Definition: otbFunctorImageFilter.h:322
otb::Functor::ReciprocalCoherencyToReciprocalMuellerFunctor::OutputValueType
TOutput::ValueType OutputValueType
Definition: otbReciprocalCoherencyToReciprocalMuellerImageFilter.h:82
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::ReciprocalCoherencyToReciprocalMuellerFunctor::ComplexType
std::complex< double > ComplexType
Definition: otbReciprocalCoherencyToReciprocalMuellerImageFilter.h:81
otb::Functor::ReciprocalCoherencyToReciprocalMuellerFunctor::operator()
void operator()(TOutput &result, const TInput &Coherency) const
Definition: otbReciprocalCoherencyToReciprocalMuellerImageFilter.h:84
otb::Functor::ReciprocalCoherencyToReciprocalMuellerFunctor
Definition: otbReciprocalCoherencyToReciprocalMuellerImageFilter.h:78
otb::ReciprocalCoherencyToReciprocalMuellerImageFilter
FunctorImageFilter< Functor::ReciprocalCoherencyToReciprocalMuellerFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType > > ReciprocalCoherencyToReciprocalMuellerImageFilter
Applies otb::Functor::ReciprocalCoherencyToReciprocalMuellerFunctor.
Definition: otbReciprocalCoherencyToReciprocalMuellerImageFilter.h:135