ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkAdaptiveHistogramEqualizationImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
70 template< typename TImageType , typename TKernel = Neighborhood<bool, TImageType::ImageDimension> >
71 class ITK_TEMPLATE_EXPORT AdaptiveHistogramEqualizationImageFilter:
72  public MovingHistogramImageFilter< TImageType,
73  TImageType,
74  TKernel,
75  typename Function::AdaptiveEqualizationHistogram< typename TImageType::PixelType,
76  typename TImageType::PixelType > >
77 
78 {
79 public:
84  typedef MovingHistogramImageFilter< TImageType,
85  TImageType,
86  TKernel,
87  typename Function::AdaptiveEqualizationHistogram< typename TImageType::PixelType,
88  typename TImageType::PixelType > >
92 
93  itkStaticConstMacro(ImageDimension, unsigned int,
94  TImageType::ImageDimension);
95 
97  itkNewMacro(Self);
98 
101 
103  typedef TImageType ImageType;
104  typedef typename ImageType::PixelType InputPixelType;
106 
110  itkSetMacro(Alpha, float);
111  itkGetConstMacro(Alpha, float);
113 
118  itkSetMacro(Beta, float);
119  itkGetConstMacro(Beta, float);
121 
122 #ifndef ITK_FUTURE_LEGACY_REMOVE
123 
127  virtual void SetUseLookupTable( const bool _arg )
128  {
129  itkDebugMacro("setting UseLookupTable to " << _arg );
130  itkGenericLegacyReplaceBodyMacro( "UseLookupTable", "", "nothing" );
131  if (this->m_UseLookupTable != _arg)
132  {
133  this->m_UseLookupTable = _arg;
134  this->Modified();
135  }
136  }
137  itkGetConstMacro(UseLookupTable, bool);
138  itkBooleanMacro(UseLookupTable);
139 #endif
140 
141 
142  virtual void ConfigureHistogram( typename Superclass::HistogramType &h) ITK_OVERRIDE
143  {
144  h.SetAlpha( this->m_Alpha );
145  h.SetBeta( this->m_Beta );
146  h.SetMinimum( this->m_InputMinimum );
147  h.SetMaximum( this->m_InputMaximum );
148 
149  typename Superclass::HistogramType::RealType kernelSize = 1;
150  for ( unsigned int i = 0; i < ImageDimension; i++ )
151  {
152  kernelSize *= ( 2 * this->GetRadius()[i] + 1 );
153  }
154  h.SetKernelSize(kernelSize);
155  }
156 
157 protected:
159  {
160  m_Alpha = .3;
161  m_Beta = .3;
162 
163  this->SetRadius(5);
164 
165  m_InputMinimum = NumericTraits< InputPixelType >::min();
166  m_InputMaximum = NumericTraits< InputPixelType >::max();
167 
168  m_UseLookupTable = false;
169  }
170 
172  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
173 
177  void BeforeThreadedGenerateData() ITK_OVERRIDE;
178 
179 private:
180  ITK_DISALLOW_COPY_AND_ASSIGN(AdaptiveHistogramEqualizationImageFilter);
181 
182  float m_Alpha;
183  float m_Beta;
184 
185  InputPixelType m_InputMinimum;
186  InputPixelType m_InputMaximum;
187 
188  bool m_UseLookupTable;
189 
190 };
191 } // end namespace itk
192 
193 #ifndef ITK_MANUAL_INSTANTIATION
194 #include "itkAdaptiveHistogramEqualizationImageFilter.hxx"
195 #endif
196 
197 #endif
Implements a generic moving histogram algorithm.
TInputImage::PixelType InputPixelType
Base class for all process objects that output image data.
static ITK_CONSTEXPR_FUNC T max(const T &)
MovingHistogramImageFilter< TImageType, TImageType, TKernel, typename Function::AdaptiveEqualizationHistogram< typename TImageType::PixelType, typename TImageType::PixelType > > Superclass
virtual void ConfigureHistogram(typename Superclass::HistogramType &h) override
static ITK_CONSTEXPR_FUNC T min(const T &)
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49