OTB  9.0.0
Orfeo Toolbox
otbComputeGainLutFilter.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 otbComputeGainLutFilter_h
22 #define otbComputeGainLutFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "otbImage.h"
26 
27 namespace otb
28 {
29 
42 template <class TInputImage, class TOutputImage>
43 class ITK_EXPORT ComputeGainLutFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
44 {
45 public:
48  typedef TInputImage InputImageType;
49  typedef TOutputImage OutputImageType;
50 
52  typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
53  typedef itk::SmartPointer<Self> Pointer;
54  typedef itk::SmartPointer<const Self> ConstPointer;
55 
56  typedef typename InputImageType::PixelType HistoType;
57  typedef typename OutputImageType::PixelType LutType;
58  typedef typename OutputImageType::InternalPixelType OutputPixelType;
59  typedef typename OutputImageType::RegionType OutputImageRegionType;
60 
62  itkNewMacro(Self);
63 
65  itkTypeMacro(ComputeGainLutFilter, ImageToImageFilter);
66 
68  itkSetMacro(NbPixel, unsigned long);
69  itkGetMacro(NbPixel, unsigned long);
71 
73  itkSetMacro(Min, double);
74  itkGetMacro(Min, double);
76 
78  itkSetMacro(Max, double);
79  itkGetMacro(Max, double);
81 
82 protected:
85  {
86  }
87  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
88 
89  void BeforeThreadedGenerateData() override;
90 
91  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
92 
93 private:
94  ComputeGainLutFilter(const Self&) = delete;
95  void operator=(const Self&) = delete;
96 
98  OutputPixelType PostProcess(unsigned int countMapValue, unsigned int countValue);
99 
102  void Equalized(const HistoType& inputHisto, HistoType& targetHisto, LutType& lut);
103 
105  void CreateTarget(const HistoType& inputHisto, HistoType& targetHisto);
106  // TODO Give the opportunity to choose the histogram target
107 
109  bool IsValid(const HistoType& inputHisto);
110 
111  double m_Min;
112  double m_Max;
113  double m_Step;
114  unsigned int m_NbBin;
115  unsigned long m_NbPixel;
116 };
117 
118 // End namespace otb
119 }
120 
121 #ifndef OTB_MANUAL_INSTANTIATION
123 #endif
124 
125 #endif
otb::ComputeGainLutFilter::m_Max
double m_Max
Definition: otbComputeGainLutFilter.h:112
otb::ComputeGainLutFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbComputeGainLutFilter.h:53
otb::ComputeGainLutFilter::~ComputeGainLutFilter
~ComputeGainLutFilter() override
Definition: otbComputeGainLutFilter.h:84
otb::ComputeGainLutFilter::Superclass
itk::ImageToImageFilter< InputImageType, OutputImageType > Superclass
Definition: otbComputeGainLutFilter.h:52
otbImage.h
otb::ComputeGainLutFilter::OutputPixelType
OutputImageType::InternalPixelType OutputPixelType
Definition: otbComputeGainLutFilter.h:58
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ComputeGainLutFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbComputeGainLutFilter.h:49
otb::ComputeGainLutFilter::Self
ComputeGainLutFilter Self
Definition: otbComputeGainLutFilter.h:51
otbComputeGainLutFilter.hxx
otb::ComputeGainLutFilter::m_Step
double m_Step
Definition: otbComputeGainLutFilter.h:113
otb::ComputeGainLutFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbComputeGainLutFilter.h:54
otb::ComputeGainLutFilter
Compute the gain for each pixel value from a histogram.
Definition: otbComputeGainLutFilter.h:43
otb::ComputeGainLutFilter::m_NbPixel
unsigned long m_NbPixel
Definition: otbComputeGainLutFilter.h:115
otb::ComputeGainLutFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbComputeGainLutFilter.h:59
otb::ComputeGainLutFilter::LutType
OutputImageType::PixelType LutType
Definition: otbComputeGainLutFilter.h:57
otb::ComputeGainLutFilter::InputImageType
TInputImage InputImageType
Definition: otbComputeGainLutFilter.h:48
otb::ComputeGainLutFilter::m_Min
double m_Min
Definition: otbComputeGainLutFilter.h:111
otb::ComputeGainLutFilter::HistoType
InputImageType::PixelType HistoType
Definition: otbComputeGainLutFilter.h:56
otb::ComputeGainLutFilter::m_NbBin
unsigned int m_NbBin
Definition: otbComputeGainLutFilter.h:114