OTB  10.0.0
Orfeo Toolbox
otbSarBrightnessFunctor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbSarBrightnessFunctor_h
23 #define otbSarBrightnessFunctor_h
24 
25 #include "otbMath.h"
26 #include "itkNumericTraits.h"
27 
28 namespace otb
29 {
30 
31 namespace Functor
32 {
41 template <class TInput, class TOutput>
42 class ITK_EXPORT SarBrightnessFunctor
43 {
44 public:
45  typedef TInput InputType;
46  typedef TOutput OutputType;
47  typedef typename itk::NumericTraits<InputType>::AbsType RealType;
48 
50  : m_Noise(0.0), m_Scale(1.0), m_AntennaPatternNewGain(1.0), m_AntennaPatternOldGain(1.0), m_RangeSpreadLoss(1.0)
51  {};
52 
54 
55  inline TOutput operator()(const TInput& value) const
56  {
57  RealType digitalNumber = static_cast<RealType>(std::abs(value));
58  RealType beta;
59 
60  beta = m_Scale * (digitalNumber * digitalNumber - m_Noise);
61  beta *= m_AntennaPatternOldGain;
62  beta /= m_AntennaPatternNewGain;
63  beta *= m_RangeSpreadLoss;
64 
65  if (beta < 0.0)
66  {
67  beta = 0.0;
68  }
69 
70  return static_cast<OutputType>(beta);
71  }
72 
74  void SetNoise(RealType value)
75  {
76  m_Noise = value;
77  }
78 
81  {
82  return m_Noise;
83  }
84 
86  void SetScale(RealType value)
87  {
88  m_Scale = value;
89  }
90 
93  {
94  return m_Scale;
95  }
96 
99  {
100  m_AntennaPatternNewGain = value;
101  }
102 
105  {
106  return m_AntennaPatternNewGain;
107  }
108 
111  {
112  m_AntennaPatternOldGain = value;
113  }
114 
117  {
118  return m_AntennaPatternOldGain;
119  }
120 
123  {
124  m_RangeSpreadLoss = value;
125  }
126 
129  {
130  return m_RangeSpreadLoss;
131  }
132 
133 private:
139 };
140 }
141 }
142 
143 #endif
Compute the brightness value. .
itk::NumericTraits< InputType >::AbsType RealType
TOutput operator()(const TInput &value) const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.