OTB  5.0.0
Orfeo Toolbox
otbReciprocalCovarianceToReciprocalCoherencyImageFilter.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 
19 #ifndef __ReciprocalCovarianceToReciprocalCoherencyImageFilter_h
20 #define __ReciprocalCovarianceToReciprocalCoherencyImageFilter_h
21 
23 
24 namespace otb
25  {
26 
27 namespace Functor {
28 
52 template< class TInput, class TOutput>
54 {
55 public:
56  typedef typename std::complex <double> ComplexType;
57  typedef typename TOutput::ValueType OutputValueType;
58 
59  inline TOutput operator()( const TInput & Covariance ) const
60  {
61  TOutput result;
62  result.SetSize(m_NumberOfComponentsPerPixel);
63 
64  /* Using the convention
65  * \f$ C_{11} = S_{hh}*S_{hh}^* \f$
66  * \f$ C_{12} = S_{hh}*S_{hv}^* \f$
67  * \f$ C_{13} = S_{hh}*S_{vv}^* \f$
68  * \f$ C_{22} = S_{hv}*S_{hv}^* \f$
69  * \f$ C_{23} = S_{hv}*S_{vv}^* \f$
70  * \f$ C_{33} = S_{vv}*S_{vv}^* \f$
71  */
72  const ComplexType C11 = static_cast<ComplexType>(Covariance[0]);
73  const ComplexType C12 = static_cast<ComplexType>(Covariance[1]);
74  const ComplexType C13 = static_cast<ComplexType>(Covariance[2]);
75  const ComplexType C22 = static_cast<ComplexType>(Covariance[3]);
76  const ComplexType C23 = static_cast<ComplexType>(Covariance[4]);
77  const ComplexType C33 = static_cast<ComplexType>(Covariance[5]);
78 
79  //const ComplexType C21 = vcl_conj(C12);
80  const ComplexType C31 = vcl_conj(C13);
81  const ComplexType C32 = vcl_conj(C23);
82 
83  result[0] = static_cast<OutputValueType>( 0.5*(C11 + C13 + C31 + C33) );
84  result[1] = static_cast<OutputValueType>( 0.5*(C11 - C13 + C31 - C33) );
85  result[2] = static_cast<OutputValueType>( C12 + C32 );
86  result[3] = static_cast<OutputValueType>( 0.5*(C11 - C13 - C31 + C33) );
87  result[4] = static_cast<OutputValueType>( C12 - C32 );
88  result[5] = static_cast<OutputValueType>( 2.0 * C22 );
89 
90  return result;
91  }
92 
93  unsigned int GetOutputSize()
94  {
96  }
97 
100 
103 
104 private:
106 };
107 }
108 
109 
121 template <class TInputImage, class TOutputImage>
123  public UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::ReciprocalCovarianceToReciprocalCoherencyFunctor<
124  typename TInputImage::PixelType, typename TOutputImage::PixelType> >
125 {
126 public:
130  typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctorType;
134 
136  itkNewMacro(Self);
137 
140 
141 
142 protected:
145 
146 private:
147  ReciprocalCovarianceToReciprocalCoherencyImageFilter(const Self&); //purposely not implemented
148  void operator=(const Self&); //purposely not implemented
149 
150 
151 };
152 
153 } // end namespace otb
154 
155 #endif
Implements pixel-wise generic operation on one image.
Functor::ReciprocalCovarianceToReciprocalCoherencyFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType > FunctorType
UnaryFunctorImageFilter< TInputImage, TOutputImage, FunctorType > Superclass