ITK  5.3.0
Insight Toolkit
itkAdaptiveHistogramEqualizationImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkAdaptiveHistogramEqualizationImageFilter_h
19 #define itkAdaptiveHistogramEqualizationImageFilter_h
20 
23 #include "itkImage.h"
24 
25 namespace itk
26 {
71 template <typename TImageType, typename TKernel = Neighborhood<bool, TImageType::ImageDimension>>
74  TImageType,
75  TImageType,
76  TKernel,
77  typename Function::AdaptiveEqualizationHistogram<typename TImageType::PixelType, typename TImageType::PixelType>>
78 
79 {
80 public:
81  ITK_DISALLOW_COPY_AND_MOVE(AdaptiveHistogramEqualizationImageFilter);
82 
88  TImageType,
89  TImageType,
90  TKernel,
94 
95  static constexpr unsigned int ImageDimension = TImageType::ImageDimension;
96 
98  itkNewMacro(Self);
99 
102 
104  using ImageType = TImageType;
105  using InputPixelType = typename ImageType::PixelType;
107 
111  itkSetMacro(Alpha, float);
112  itkGetConstMacro(Alpha, float);
114 
119  itkSetMacro(Beta, float);
120  itkGetConstMacro(Beta, float);
122 
123 #if !defined(ITK_FUTURE_LEGACY_REMOVE)
124 
128  virtual void
129  SetUseLookupTable(const bool _arg)
130  {
131  itkDebugMacro("setting UseLookupTable to " << _arg);
132  itkGenericLegacyReplaceBodyMacro("UseLookupTable", "", "nothing");
133  if (this->m_UseLookupTable != _arg)
134  {
135  this->m_UseLookupTable = _arg;
136  this->Modified();
137  }
138  }
139  itkGetConstMacro(UseLookupTable, bool);
140  itkBooleanMacro(UseLookupTable);
141 #endif
142 
143 
144  void
145  ConfigureHistogram(typename Superclass::HistogramType & h) override
146  {
147  h.SetAlpha(this->m_Alpha);
148  h.SetBeta(this->m_Beta);
149  h.SetMinimum(this->m_InputMinimum);
150  h.SetMaximum(this->m_InputMaximum);
151 
152  typename Superclass::HistogramType::RealType kernelSize = 1;
153  for (unsigned int i = 0; i < ImageDimension; ++i)
154  {
155  kernelSize *= (2 * this->GetRadius()[i] + 1);
156  }
157  h.SetKernelSize(kernelSize);
158  }
159 
160 protected:
162  {
163  m_Alpha = .3;
164  m_Beta = .3;
165 
166  this->SetRadius(5);
167 
168  m_InputMinimum = NumericTraits<InputPixelType>::min();
169  m_InputMaximum = NumericTraits<InputPixelType>::max();
170 
171  m_UseLookupTable = false;
172  }
173 
174  ~AdaptiveHistogramEqualizationImageFilter() override = default;
175  void
176  PrintSelf(std::ostream & os, Indent indent) const override;
177 
181  void
182  BeforeThreadedGenerateData() override;
183 
184 private:
185  float m_Alpha;
186  float m_Beta;
187 
190 
192 };
193 } // end namespace itk
194 
195 #ifndef ITK_MANUAL_INSTANTIATION
196 # include "itkAdaptiveHistogramEqualizationImageFilter.hxx"
197 #endif
198 
199 #endif
itk::AdaptiveHistogramEqualizationImageFilter::m_UseLookupTable
bool m_UseLookupTable
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:191
itk::Function::AdaptiveEqualizationHistogram
Definition: itkAdaptiveEqualizationHistogram.h:40
itk::AdaptiveHistogramEqualizationImageFilter::ConfigureHistogram
void ConfigureHistogram(typename Superclass::HistogramType &h) override
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:145
itk::NumericTraits::min
static constexpr T min(const T &)
Definition: itkNumericTraits.h:172
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkImage.h
itk::AdaptiveHistogramEqualizationImageFilter::m_InputMaximum
InputPixelType m_InputMaximum
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:189
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::AdaptiveHistogramEqualizationImageFilter::m_InputMinimum
InputPixelType m_InputMinimum
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:188
itk::AdaptiveHistogramEqualizationImageFilter::AdaptiveHistogramEqualizationImageFilter
AdaptiveHistogramEqualizationImageFilter()
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:161
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::BoxImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkBoxImageFilter.h:64
itk::AdaptiveHistogramEqualizationImageFilter
Power Law Adaptive Histogram Equalization.
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:72
itk::AdaptiveHistogramEqualizationImageFilter::m_Alpha
float m_Alpha
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:185
itk::AdaptiveHistogramEqualizationImageFilter::ImageType
TImageType ImageType
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:104
itk::NumericTraits::max
static constexpr T max(const T &)
Definition: itkNumericTraits.h:167
itk::AdaptiveHistogramEqualizationImageFilter::ImageSizeType
typename ImageType::SizeType ImageSizeType
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:106
itk::MovingHistogramImageFilter
Implements a generic moving histogram algorithm.
Definition: itkMovingHistogramImageFilter.h:88
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itkAdaptiveEqualizationHistogram.h
itkMovingHistogramImageFilter.h
itk::AdaptiveHistogramEqualizationImageFilter::m_Beta
float m_Beta
Definition: itkAdaptiveHistogramEqualizationImageFilter.h:186