OTB  10.0.0
Orfeo Toolbox
otbApplyGainFilter.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 #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 DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
122 
123  void VerifyInputInformation() const override
124  {
125 
126  }
127 
128 private:
129  ApplyGainFilter(const Self&) = delete;
130  void operator=(const Self&) = delete;
131 
133  double InterpolateGain(typename LutType::ConstPointer gridLut, unsigned int pixelValue, typename InputImageType::IndexType index);
134 
140  double m_Step;
141  typename LutType::SizeType m_LutSize{0,0};
142  typename InputImageType::SizeType m_ThumbSize{0,0};
143 };
144 
145 } // End namespace otb
146 
147 #ifndef OTB_MANUAL_INSTANTIATION
148 #include "otbApplyGainFilter.hxx"
149 #endif
150 
151 
152 #endif
Apply gain on the input image with a bilineare interpolation.
itk::SmartPointer< Self > Pointer
TOutputImage OutputImageType
itk::SmartPointer< const Self > ConstPointer
void VerifyInputInformation() const override
InputImageType::InternalPixelType InputPixelType
OutputImageType::RegionType OutputImageRegionType
itk::ImageToImageFilter< InputImageType, OutputImageType > Superclass
ApplyGainFilter(const Self &)=delete
OutputImageType::InternalPixelType OutputPixelType
void operator=(const Self &)=delete
Compute local histogram with several parameters.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.