OTB  9.0.0
Orfeo Toolbox
otbApplyGainFilter.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 #ifndef otbApplyGainFilter_h
22 #define otbApplyGainFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "otbImage.h"
26 
27 namespace otb
28 {
29 
41 template <class TInputImage, class TLut, class TOutputImage>
42 class ITK_EXPORT ApplyGainFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
43 {
44 public:
47  typedef TInputImage InputImageType;
48  typedef TOutputImage OutputImageType;
49 
51  typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
52  typedef itk::SmartPointer<Self> Pointer;
53  typedef itk::SmartPointer<const Self> ConstPointer;
54 
55  typedef TLut LutType;
56  typedef typename InputImageType::InternalPixelType InputPixelType;
57  typedef typename OutputImageType::InternalPixelType OutputPixelType;
58  typedef typename OutputImageType::RegionType OutputImageRegionType;
59 
61  itkNewMacro(Self);
62 
64  itkTypeMacro(ComputeHistoFilter, ImageToImageFilter);
65 
67  itkSetMacro(NoData, InputPixelType);
68  itkGetMacro(NoData, InputPixelType);
70 
72  itkBooleanMacro(NoDataFlag);
73  itkGetMacro(NoDataFlag, bool);
74  itkSetMacro(NoDataFlag, bool);
76 
78  itkBooleanMacro(ThumbSizeFromSpacing);
79  itkGetMacro(ThumbSizeFromSpacing, bool);
80  itkSetMacro(ThumbSizeFromSpacing, bool);
82 
84  itkSetMacro(ThumbSize, typename InputImageType::SizeType);
85  itkGetMacro(ThumbSize, typename InputImageType::SizeType);
87 
89  itkSetMacro(Min, InputPixelType);
90  itkGetMacro(Min, InputPixelType);
92 
94  itkSetMacro(Max, InputPixelType);
95  itkGetMacro(Max, InputPixelType);
97 
99  void SetInputLut(const LutType* lut);
100 
102  void SetInputImage(const InputImageType* input);
103 
104 protected:
105  ApplyGainFilter();
106  ~ApplyGainFilter() override
107  {
108  }
109  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
110 
112  const InputImageType* GetInputImage() const;
113 
115  const LutType* GetInputLut() const;
116 
117  void GenerateInputRequestedRegion() override;
118 
119  void BeforeThreadedGenerateData() override;
120 
121  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
122  void VerifyInputInformation() override{};
123 
124 private:
125  ApplyGainFilter(const Self&) = delete;
126  void operator=(const Self&) = delete;
127 
129  double InterpolateGain(typename LutType::ConstPointer gridLut, unsigned int pixelValue, typename InputImageType::IndexType index);
130 
136  double m_Step;
137  typename LutType::SizeType m_LutSize{0,0};
138  typename InputImageType::SizeType m_ThumbSize{0,0};
139 };
140 
141 } // End namespace otb
142 
143 #ifndef OTB_MANUAL_INSTANTIATION
144 #include "otbApplyGainFilter.hxx"
145 #endif
146 
147 
148 #endif
otb::ApplyGainFilter::LutType
TLut LutType
Definition: otbApplyGainFilter.h:55
otb::ApplyGainFilter::VerifyInputInformation
void VerifyInputInformation() override
Definition: otbApplyGainFilter.h:122
otbImage.h
otb::ApplyGainFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbApplyGainFilter.h:52
otb::ApplyGainFilter::OutputPixelType
OutputImageType::InternalPixelType OutputPixelType
Definition: otbApplyGainFilter.h:57
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ApplyGainFilter::m_NoDataFlag
bool m_NoDataFlag
Definition: otbApplyGainFilter.h:134
otb::ApplyGainFilter::m_ThumbSizeFromSpacing
bool m_ThumbSizeFromSpacing
Definition: otbApplyGainFilter.h:135
otb::ApplyGainFilter::InputPixelType
InputImageType::InternalPixelType InputPixelType
Definition: otbApplyGainFilter.h:56
otb::ApplyGainFilter::Superclass
itk::ImageToImageFilter< InputImageType, OutputImageType > Superclass
Definition: otbApplyGainFilter.h:51
otb::ApplyGainFilter::m_NoData
InputPixelType m_NoData
Definition: otbApplyGainFilter.h:131
otb::ComputeHistoFilter
Compute local histogram with several parameters.
Definition: otbComputeHistoFilter.h:43
otb::ApplyGainFilter::InputImageType
TInputImage InputImageType
Definition: otbApplyGainFilter.h:47
otb::ApplyGainFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbApplyGainFilter.h:58
otb::ApplyGainFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbApplyGainFilter.h:53
otb::ApplyGainFilter::m_Min
InputPixelType m_Min
Definition: otbApplyGainFilter.h:132
otb::ApplyGainFilter::Self
ApplyGainFilter Self
Definition: otbApplyGainFilter.h:50
otb::ApplyGainFilter::~ApplyGainFilter
~ApplyGainFilter() override
Definition: otbApplyGainFilter.h:106
otb::ApplyGainFilter
Apply gain on the input image with a bilineare interpolation.
Definition: otbApplyGainFilter.h:42
otb::ApplyGainFilter::m_Step
double m_Step
Definition: otbApplyGainFilter.h:136
otb::ApplyGainFilter::m_Max
InputPixelType m_Max
Definition: otbApplyGainFilter.h:133
otbApplyGainFilter.hxx
otb::ApplyGainFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbApplyGainFilter.h:48