OTB  9.0.0
Orfeo Toolbox
otbSarBrightnessFunctor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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
otb::Functor::SarBrightnessFunctor::m_Scale
RealType m_Scale
Definition: otbSarBrightnessFunctor.h:135
otb::Functor::SarBrightnessFunctor::GetAntennaPatternOldGain
RealType GetAntennaPatternOldGain() const
Definition: otbSarBrightnessFunctor.h:116
otb::Functor::SarBrightnessFunctor::SetNoise
void SetNoise(RealType value)
Definition: otbSarBrightnessFunctor.h:74
otb::Functor::SarBrightnessFunctor::SetAntennaPatternNewGain
void SetAntennaPatternNewGain(RealType value)
Definition: otbSarBrightnessFunctor.h:98
otb::Functor::SarBrightnessFunctor::SarBrightnessFunctor
SarBrightnessFunctor()
Definition: otbSarBrightnessFunctor.h:49
otb::Functor::SarBrightnessFunctor::SetRangeSpreadLoss
void SetRangeSpreadLoss(RealType value)
Definition: otbSarBrightnessFunctor.h:122
otb::Functor::SarBrightnessFunctor::SetAntennaPatternOldGain
void SetAntennaPatternOldGain(RealType value)
Definition: otbSarBrightnessFunctor.h:110
otb::Functor::SarBrightnessFunctor
Compute the brightness value. .
Definition: otbSarBrightnessFunctor.h:42
otbMath.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::SarBrightnessFunctor::operator()
TOutput operator()(const TInput &value) const
Definition: otbSarBrightnessFunctor.h:55
otb::Functor::SarBrightnessFunctor::SetScale
void SetScale(RealType value)
Definition: otbSarBrightnessFunctor.h:86
otb::Functor::SarBrightnessFunctor::GetScale
RealType GetScale() const
Definition: otbSarBrightnessFunctor.h:92
otb::Functor::SarBrightnessFunctor::m_AntennaPatternNewGain
RealType m_AntennaPatternNewGain
Definition: otbSarBrightnessFunctor.h:136
otb::Functor::SarBrightnessFunctor::~SarBrightnessFunctor
~SarBrightnessFunctor()
Definition: otbSarBrightnessFunctor.h:53
otb::Functor::SarBrightnessFunctor::OutputType
TOutput OutputType
Definition: otbSarBrightnessFunctor.h:46
otb::Functor::SarBrightnessFunctor::GetRangeSpreadLoss
RealType GetRangeSpreadLoss() const
Definition: otbSarBrightnessFunctor.h:128
otb::Functor::SarBrightnessFunctor::m_RangeSpreadLoss
RealType m_RangeSpreadLoss
Definition: otbSarBrightnessFunctor.h:138
otb::Functor::SarBrightnessFunctor::RealType
itk::NumericTraits< InputType >::AbsType RealType
Definition: otbSarBrightnessFunctor.h:47
otb::Functor::SarBrightnessFunctor::GetNoise
RealType GetNoise() const
Definition: otbSarBrightnessFunctor.h:80
otb::Functor::SarBrightnessFunctor::GetAntennaPatternNewGain
RealType GetAntennaPatternNewGain() const
Definition: otbSarBrightnessFunctor.h:104
otb::Functor::SarBrightnessFunctor::InputType
TInput InputType
Definition: otbSarBrightnessFunctor.h:45
otb::Functor::SarBrightnessFunctor::m_Noise
RealType m_Noise
Definition: otbSarBrightnessFunctor.h:134
otb::Functor::SarBrightnessFunctor::m_AntennaPatternOldGain
RealType m_AntennaPatternOldGain
Definition: otbSarBrightnessFunctor.h:137