Orfeo Toolbox  4.0
otbMuellerToPolarisationDegreeAndPowerImageFilter.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 __MuellerToPolarisationDegreeAndPowerImageFilter_h
20 #define __MuellerToPolarisationDegreeAndPowerImageFilter_h
21 
23 #include "itkNumericTraits.h"
24 #include "itkMatrix.h"
25 #include "itkVector.h"
26 #include "otbMath.h"
27 
28 namespace otb
29  {
30 
31 namespace Functor {
32 
74 template< class TInput, class TOutput>
76 {
77 public:
78  typedef typename TOutput::ValueType OutputValueType;
81 
82  inline TOutput operator()( const TInput & Mueller ) const
83  {
84  double P;
85  double deg_pol;
86  double tau;
87  double psi;
90 
91  double l_PowerMin(itk::NumericTraits<double>::max());
92  double l_PowerMax(itk::NumericTraits<double>::min());
93  double l_PolarisationDegreeMin(itk::NumericTraits<double>::max());
94  double l_PolarisationDegreeMax(itk::NumericTraits<double>::min());
95 
96  TOutput result;
97  result.SetSize(m_NumberOfComponentsPerPixel);
98 
99  MuellerMatrixType muellerMatrix;
100  muellerMatrix[0][0] = Mueller[0];
101  muellerMatrix[0][1] = Mueller[1];
102  muellerMatrix[0][2] = Mueller[2];
103  muellerMatrix[0][3] = Mueller[3];
104  muellerMatrix[1][0] = Mueller[4];
105  muellerMatrix[1][1] = Mueller[5];
106  muellerMatrix[1][2] = Mueller[6];
107  muellerMatrix[1][3] = Mueller[7];
108  muellerMatrix[2][0] = Mueller[8];
109  muellerMatrix[2][1] = Mueller[9];
110  muellerMatrix[2][2] = Mueller[10];
111  muellerMatrix[2][3] = Mueller[11];
112  muellerMatrix[3][0] = Mueller[12];
113  muellerMatrix[3][1] = Mueller[13];
114  muellerMatrix[3][2] = Mueller[14];
115  muellerMatrix[3][3] = Mueller[15];
116 
117  tau = -45.0;
118  while (tau < 46.0)
119  {
120  psi = -90.0;
121  while (psi < 91.0)
122  {
123  // Define the incident Stokes vector
124  Si[0] = 1.0;
125  Si[1] = cos(psi * m_PI_90) * cos(tau * m_PI_90);
126  Si[2] = sin(psi * m_PI_90) * cos(tau * m_PI_90);
127  Si[3] = sin(tau * m_PI_90);
128 
129  // Evaluate the received Stokes vector
130  Sr = muellerMatrix * Si;
131 
132  //Evaluate Power and Polarisation degree
133  P = Sr[0];
134 
135  if (P < m_Epsilon)
136  {
137  deg_pol = 0.;
138  }
139  else
140  {
141  deg_pol = vcl_sqrt(Sr[1] * Sr[1] + Sr[2] * Sr[2] + Sr[3] * Sr[3]) / Sr[0];
142  }
143 
144  if (P > l_PowerMax)
145  {
146  l_PowerMax = P;
147  }
148  else
149  {
150  l_PowerMin = P;
151  }
152 
153  if (deg_pol > l_PolarisationDegreeMax)
154  {
155  l_PolarisationDegreeMax = deg_pol;
156  }
157  else
158  {
159  l_PolarisationDegreeMin = deg_pol;
160  }
161  psi += 5.0;
162  }
163  tau += 5.0;
164  }
165 
166  result[0] = l_PowerMin;
167  result[1] = l_PowerMax;
168  result[2] = l_PolarisationDegreeMin;
169  result[3] = l_PolarisationDegreeMax;
170 
171 
172  return result;
173  }
174 
175  unsigned int GetOutputSize()
176  {
178  }
179 
182 
185 
186 private:
188  const double m_Epsilon;
189  const double m_PI_90;
190 };
191 }
192 
193 
203 template <class TInputImage, class TOutputImage>
205  public UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::MuellerToPolarisationDegreeAndPowerFunctor<
206  typename TInputImage::PixelType, typename TOutputImage::PixelType> >
207 {
208 public:
212  typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctionType;
216 
218  itkNewMacro(Self);
219 
222 
223 
224 protected:
227 
228 private:
229  MuellerToPolarisationDegreeAndPowerImageFilter(const Self&); //purposely not implemented
230  void operator=(const Self&); //purposely not implemented
231 };
232 
233 } // end namespace otb
234 
235 #endif

Generated at Sat Mar 8 2014 16:09:30 for Orfeo Toolbox with doxygen 1.8.3.1