OTB  5.4.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 
65  const ComplexType C11 = static_cast<ComplexType>(Covariance[0]);
66  const ComplexType C12 = static_cast<ComplexType>(Covariance[1]);
67  const ComplexType C13 = static_cast<ComplexType>(Covariance[2]);
68  const ComplexType C22 = static_cast<ComplexType>(Covariance[3]);
69  const ComplexType C23 = static_cast<ComplexType>(Covariance[4]);
70  const ComplexType C33 = static_cast<ComplexType>(Covariance[5]);
71 
72  const ComplexType two = ComplexType(2.0, 0.0);
73  const ComplexType rootTwo = ComplexType(vcl_sqrt(2.0), 0.0);
74 
75  result[0] = static_cast<OutputValueType>( C33 + C13 + vcl_conj(C13) + C11 );
76  result[1] = static_cast<OutputValueType>( -C33 - C13 + vcl_conj(C13) + C11 );
77  result[2] = static_cast<OutputValueType>( rootTwo*C12 + rootTwo*vcl_conj(C23) );
78  result[3] = static_cast<OutputValueType>( C33 - C13 - vcl_conj(C13) + C11 );
79  result[4] = static_cast<OutputValueType>( rootTwo*C12 - rootTwo*vcl_conj(C23) );
80  result[5] = static_cast<OutputValueType>( two * C22 );
81 
82  result /= 2.0;
83 
84  return result;
85  }
86 
87  unsigned int GetOutputSize()
88  {
90  }
91 
94 
97 
98 private:
100 };
101 }
102 
103 
115 template <class TInputImage, class TOutputImage>
117  public UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::ReciprocalCovarianceToReciprocalCoherencyFunctor<
118  typename TInputImage::PixelType, typename TOutputImage::PixelType> >
119 {
120 public:
124  typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctorType;
128 
130  itkNewMacro(Self);
131 
134 
135 
136 protected:
139 
140 private:
141  ReciprocalCovarianceToReciprocalCoherencyImageFilter(const Self&); //purposely not implemented
142  void operator=(const Self&); //purposely not implemented
143 
144 
145 };
146 
147 } // end namespace otb
148 
149 #endif
Implements pixel-wise generic operation on one image.
Functor::ReciprocalCovarianceToReciprocalCoherencyFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType > FunctorType
UnaryFunctorImageFilter< TInputImage, TOutputImage, FunctorType > Superclass