ITK  6.0.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 * https://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
25namespace itk
26{
71template <typename TImageType, typename TKernel = Neighborhood<bool, TImageType::ImageDimension>>
72class ITK_TEMPLATE_EXPORT AdaptiveHistogramEqualizationImageFilter
74 TImageType,
75 TImageType,
76 TKernel,
77 typename Function::AdaptiveEqualizationHistogram<typename TImageType::PixelType, typename TImageType::PixelType>>
78
79{
80public:
81 ITK_DISALLOW_COPY_AND_MOVE(AdaptiveHistogramEqualizationImageFilter);
82
88 TImageType,
89 TImageType,
90 TKernel,
95 static constexpr unsigned int ImageDimension = TImageType::ImageDimension;
96
98 itkNewMacro(Self);
99
101 itkOverrideGetNameOfClassMacro(AdaptiveHistogramEqualizationImageFilter);
102
104 using ImageType = TImageType;
105 using InputPixelType = typename ImageType::PixelType;
106 using ImageSizeType = typename ImageType::SizeType;
107
111 itkSetMacro(Alpha, float);
112 itkGetConstMacro(Alpha, float);
119 itkSetMacro(Beta, float);
120 itkGetConstMacro(Beta, float);
123#if !defined(ITK_FUTURE_LEGACY_REMOVE)
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
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
160protected:
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 }
175 void
176 PrintSelf(std::ostream & os, Indent indent) const override;
177
181 void
182 BeforeThreadedGenerateData() override;
183
184private:
185 float m_Alpha{};
186 float m_Beta{};
188 InputPixelType m_InputMinimum{};
189 InputPixelType m_InputMaximum{};
191 bool m_UseLookupTable{};
192};
193} // end namespace itk
194
195#ifndef ITK_MANUAL_INSTANTIATION
196# include "itkAdaptiveHistogramEqualizationImageFilter.hxx"
197#endif
198
199#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Implements a generic moving histogram algorithm.
static constexpr T max(const T &)
static constexpr T min(const T &)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....