Orfeo Toolbox  4.0
otbSarRadiometricCalibrationFunction.txx
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 __otbSarRadiometricCalibrationFunction_txx
20 #define __otbSarRadiometricCalibrationFunction_txx
21 
24 #include "itkNumericTraits.h"
25 
26 namespace otb
27 {
28 
32 template <class TInputImage, class TCoordRep>
35  m_Scale(1.0)
36 {
37  m_Noise = ParametricFunctionType::New();
38  m_AntennaPatternNewGain = ParametricFunctionType::New();
39  m_AntennaPatternOldGain = ParametricFunctionType::New();
40  m_IncidenceAngle = ParametricFunctionType::New();
41  m_RangeSpreadLoss = ParametricFunctionType::New();
42 
43  m_Noise->SetConstantValue(0.0);
44  m_EnableNoise = true;
45  m_AntennaPatternNewGain->SetConstantValue(1.0);
46  m_AntennaPatternOldGain->SetConstantValue(1.0);
47  m_IncidenceAngle->SetConstantValue(CONST_PI_2);
48  m_RangeSpreadLoss->SetConstantValue(1.0);
49 }
50 
54 template <class TInputImage, class TCoordRep>
55 void
58  const InputImageType * ptr )
59 {
60  Superclass::SetInputImage(ptr);
61  m_Noise->SetInputImage(ptr);
62  m_IncidenceAngle->SetInputImage(ptr);
63  m_AntennaPatternNewGain->SetInputImage(ptr);
64  m_AntennaPatternOldGain->SetInputImage(ptr);
65  m_RangeSpreadLoss->SetInputImage(ptr);
66 }
67 
71 template <class TInputImage, class TCoordRep>
72 void
74 ::PrintSelf(std::ostream& os, itk::Indent indent) const
75 {
76  this->Superclass::PrintSelf(os, indent);
77 }
78 
82 template <class TInputImage, class TCoordRep>
84 ::OutputType
86 ::Evaluate(const PointType& point) const
87 {
88  IndexType index;
89  this->GetInputImage()->TransformPhysicalPointToIndex(point, index);
90 
91  if (!this->GetInputImage())
92  {
93  itkDebugMacro( <<"ERROR with GetInputImage()");
95  }
96 
97  if (!this->IsInsideBuffer(index))
98  {
99  itkDebugMacro( << "ERROR with IsInsideBuffer");
101  }
102 
103  FunctorType functor;
104  if (m_EnableNoise)
105  {
106  functor.SetNoise(static_cast<FunctorRealType>(m_Noise->Evaluate(point)));
107  }
108  functor.SetScale(m_Scale);
109  functor.SetAntennaPatternNewGain(static_cast<FunctorRealType>(m_AntennaPatternNewGain->Evaluate(point)));
110  functor.SetAntennaPatternOldGain(static_cast<FunctorRealType>(m_AntennaPatternOldGain->Evaluate(point)));
111  functor.SetIncidenceAngle(static_cast<FunctorRealType>(m_IncidenceAngle->Evaluate(point)));
112  functor.SetRangeSpreadLoss(static_cast<FunctorRealType>(m_RangeSpreadLoss->Evaluate(point)));
113 
114  const RealType value = static_cast<RealType>(vcl_abs(this->GetInputImage()->GetPixel(index)));
115  RealType result = functor(value);
116 
117  return static_cast<OutputType>(result);
118 }
119 
120 } // end namespace otb
121 
122 #endif

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