OTB  6.7.0
Orfeo Toolbox
otbReciprocalCoherencyToReciprocalMuellerImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 
76 template< class TInput, class TOutput>
78 {
79 public:
80  typedef typename std::complex <double> ComplexType;
81  typedef typename TOutput::ValueType OutputValueType;
82 
83  inline void operator()(TOutput& result, const TInput& Coherency) const
84  {
85  const double T1 = static_cast<double>(Coherency[0].real());
86  const double T2 = static_cast<double>(Coherency[3].real());
87  const double T3 = static_cast<double>(Coherency[5].real());
88 
89  ComplexType VAL4 = static_cast<ComplexType>( (Coherency[1] - Coherency[3]) );
90  ComplexType VAL5 = static_cast<ComplexType>( (Coherency[1] - Coherency[0]) );
91  ComplexType VAL0 = static_cast<ComplexType>(Coherency[5]) + VAL5 - std::conj(VAL4);
92  ComplexType VAL1 = static_cast<ComplexType>( -Coherency[5] ) + VAL5 - std::conj(VAL4);
93 
94  result[0] = 0.5 * (T1 + T2 + T3);
95  result[1] = static_cast<double>( Coherency[1].real()+Coherency[3].imag() );
96  result[2] = static_cast<double>(Coherency[2].real());
97  result[3] = static_cast<double>(Coherency[4].imag());
98  result[4] = static_cast<double>(Coherency[1].real());
99  result[5] = 0.5 * (T1 + T2 - T3);
100  result[6] = static_cast<double>( Coherency[4].real() );
101  result[7] = static_cast<double>(Coherency[2].imag());
102  result[8] = static_cast<double>( -Coherency[2].real() );
103  result[9] = static_cast<double>( -Coherency[4].real() );
104  result[10] = static_cast<double>(0.5 * VAL1.real());
105  result[11] = static_cast<double>(0.5 * VAL0.imag());
106  result[12] = static_cast<double>(Coherency[4].imag());
107  result[13] = static_cast<double>(Coherency[2].imag());
108  result[14] = static_cast<double>(0.5 * std::conj(VAL1).imag());
109  result[15] = static_cast<double>(0.5 * VAL0.real());
110  }
111 
112  constexpr size_t OutputSize(...) const
113  {
114  // Size of the reciprocal mueller matrix
115  return 16;
116  }
117 };
118 } // namespace Functor
119 
132 template <typename TInputImage, typename TOutputImage>
135 
136 } // end namespace otb
137 
138 #endif
A generic functor filter templated by its functor.
FunctorImageFilter< Functor::ReciprocalCoherencyToReciprocalMuellerFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType >> ReciprocalCoherencyToReciprocalMuellerImageFilter
Applies otb::Functor::ReciprocalCoherencyToReciprocalMuellerFunctor.