OTB  6.1.0
Orfeo Toolbox
otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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 otbReciprocalCovarianceToReciprocalCoherencyImageFilter_h
23 #define otbReciprocalCovarianceToReciprocalCoherencyImageFilter_h
24 
26 
27 namespace otb
28  {
29 
30 namespace Functor {
31 
55 template< class TInput, class TOutput>
57 {
58 public:
59  typedef typename std::complex <double> ComplexType;
60  typedef typename TOutput::ValueType OutputValueType;
61 
62  inline TOutput operator()( const TInput & Covariance ) const
63  {
64  TOutput result;
65  result.SetSize(m_NumberOfComponentsPerPixel);
66 
67 
68  const ComplexType C11 = static_cast<ComplexType>(Covariance[0]);
69  const ComplexType C12 = static_cast<ComplexType>(Covariance[1]);
70  const ComplexType C13 = static_cast<ComplexType>(Covariance[2]);
71  const ComplexType C22 = static_cast<ComplexType>(Covariance[3]);
72  const ComplexType C23 = static_cast<ComplexType>(Covariance[4]);
73  const ComplexType C33 = static_cast<ComplexType>(Covariance[5]);
74 
75  const ComplexType two = ComplexType(2.0, 0.0);
76  const ComplexType rootTwo = ComplexType(vcl_sqrt(2.0), 0.0);
77 
78  result[0] = static_cast<OutputValueType>( C33 + C13 + vcl_conj(C13) + C11 );
79  result[1] = static_cast<OutputValueType>( -C33 - C13 + vcl_conj(C13) + C11 );
80  result[2] = static_cast<OutputValueType>( rootTwo*C12 + rootTwo*vcl_conj(C23) );
81  result[3] = static_cast<OutputValueType>( C33 - C13 - vcl_conj(C13) + C11 );
82  result[4] = static_cast<OutputValueType>( rootTwo*C12 - rootTwo*vcl_conj(C23) );
83  result[5] = static_cast<OutputValueType>( two * C22 );
84 
85  result /= 2.0;
86 
87  return result;
88  }
89 
90  unsigned int GetOutputSize()
91  {
93  }
94 
97 
100 
101 private:
103 };
104 }
105 
106 
118 template <class TInputImage, class TOutputImage>
120  public UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::ReciprocalCovarianceToReciprocalCoherencyFunctor<
121  typename TInputImage::PixelType, typename TOutputImage::PixelType> >
122 {
123 public:
127  typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctorType;
131 
133  itkNewMacro(Self);
134 
137 
138 
139 protected:
142 
143 private:
144  ReciprocalCovarianceToReciprocalCoherencyImageFilter(const Self&); //purposely not implemented
145  void operator=(const Self&); //purposely not implemented
146 
147 
148 };
149 
150 } // end namespace otb
151 
152 #endif
Implements pixel-wise generic operation on one image.
Functor::ReciprocalCovarianceToReciprocalCoherencyFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType > FunctorType
UnaryFunctorImageFilter< TInputImage, TOutputImage, FunctorType > Superclass