OTB  6.7.0
Orfeo Toolbox
otbApplyGainFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 :
43  public itk::ImageToImageFilter< TInputImage , TOutputImage >
44 {
45 public :
48  typedef TInputImage InputImageType;
49  typedef TOutputImage OutputImageType;
50 
55 
56  typedef TLut LutType;
57  typedef typename InputImageType::InternalPixelType InputPixelType;
58  typedef typename OutputImageType::InternalPixelType OutputPixelType;
59  typedef typename OutputImageType::RegionType OutputImageRegionType;
60 
62  itkNewMacro(Self);
63 
65  itkTypeMacro(ComputeHistoFilter, ImageToImageFilter);
66 
68  itkSetMacro(NoData, InputPixelType);
69  itkGetMacro(NoData, InputPixelType);
71 
73  itkBooleanMacro(NoDataFlag);
74  itkGetMacro(NoDataFlag, bool);
75  itkSetMacro(NoDataFlag, bool);
77 
79  itkBooleanMacro(ThumbSizeFromSpacing);
80  itkGetMacro(ThumbSizeFromSpacing, bool);
81  itkSetMacro(ThumbSizeFromSpacing, bool);
83 
85  itkSetMacro(ThumbSize, typename InputImageType::SizeType);
86  itkGetMacro(ThumbSize, typename InputImageType::SizeType);
88 
90  itkSetMacro(Min, InputPixelType);
91  itkGetMacro(Min, InputPixelType);
93 
95  itkSetMacro(Max, InputPixelType);
96  itkGetMacro(Max, InputPixelType);
98 
100  void SetInputLut( const LutType * lut) ;
101 
103  void SetInputImage( const InputImageType * input) ;
104 
105 protected :
106  ApplyGainFilter();
107  ~ApplyGainFilter() override {}
108  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
109 
111  const InputImageType * GetInputImage() const;
112 
114  const LutType * GetInputLut() const;
115 
116  void GenerateInputRequestedRegion() override;
117 
118  void BeforeThreadedGenerateData() override;
119 
120  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
121  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 ,
130  unsigned int pixelValue ,
131  typename InputImageType::IndexType index);
132 
138  double m_Step;
141 
142 
143 };
144 
145 } // End namespace otb
146 
147 #ifndef OTB_MANUAL_INSTANTIATION
148 #include "otbApplyGainFilter.hxx"
149 #endif
150 
151 
152 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
itk::SmartPointer< const Self > ConstPointer
Apply gain on the input image with a bilineare interpolation.
LutType::SizeType m_LutSize
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
itk::SmartPointer< Self > Pointer
TInputImage InputImageType
TOutputImage OutputImageType
unsigned int ThreadIdType
InputImageType::SizeType m_ThumbSize
OutputImageType::RegionType OutputImageRegionType
void VerifyInputInformation() override
OutputImageType::InternalPixelType OutputPixelType
InputImageType::InternalPixelType InputPixelType
Compute local histogram with several parameters.
itk::ImageToImageFilter< InputImageType, OutputImageType > Superclass