ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkBilateralImageFilter.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 __itkBilateralImageFilter_h
19 #define __itkBilateralImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkFixedArray.h"
24 #include "itkNeighborhood.h"
25 
26 namespace itk
27 {
74 template< class TInputImage, class TOutputImage >
75 class ITK_EXPORT BilateralImageFilter:
76  public ImageToImageFilter< TInputImage, TOutputImage >
77 {
78 public:
84 
86  itkNewMacro(Self);
87 
90 
92  typedef TInputImage InputImageType;
93  typedef TOutputImage OutputImageType;
94 
96  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
97 
100  typedef typename TOutputImage::PixelType OutputPixelType;
101  typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
103  typedef typename TInputImage::PixelType InputPixelType;
104  typedef typename TInputImage::InternalPixelType InputInternalPixelType;
105 
108  itkStaticConstMacro(ImageDimension, unsigned int,
109  TOutputImage::ImageDimension);
110 
113 
116 
118  typedef
120  typedef typename KernelType::SizeType SizeType;
122 
126 
128  typedef
130 
134  itkSetMacro(DomainSigma, ArrayType);
135  itkGetConstMacro(DomainSigma, const ArrayType);
136  itkSetMacro(RangeSigma, double);
137  itkGetConstMacro(RangeSigma, double);
138  itkGetConstMacro(FilterDimensionality, unsigned int);
139  itkSetMacro(FilterDimensionality, unsigned int);
141 
144  void SetDomainSigma(const double v)
145  {
146  m_DomainSigma.Fill(v);
147  }
148 
154  itkBooleanMacro(AutomaticKernelSize);
155  itkGetConstMacro(AutomaticKernelSize, bool);
156  itkSetMacro(AutomaticKernelSize, bool);
158 
161  void SetRadius(const SizeValueType);
162 
163  itkSetMacro(Radius, SizeType);
164  itkGetConstReferenceMacro(Radius, SizeType);
165 
169  itkSetMacro(NumberOfRangeGaussianSamples, unsigned long);
170  itkGetConstMacro(NumberOfRangeGaussianSamples, unsigned long);
172 
173 #ifdef ITK_USE_CONCEPT_CHECKING
174 
175  itkConceptMacro( OutputHasNumericTraitsCheck,
177 
179 #endif
180 
181 protected:
185  {
186  m_Radius.Fill(1);
187  m_AutomaticKernelSize = true;
188  m_DomainSigma.Fill(4.0);
189  m_RangeSigma = 50.0;
190  m_FilterDimensionality = ImageDimension;
191  m_NumberOfRangeGaussianSamples = 100;
192  m_DynamicRange = 0.0;
193  m_DynamicRangeUsed = 0.0;
194  m_DomainMu = 2.5; // keep small to keep kernels small
195  m_RangeMu = 4.0; // can be bigger then DomainMu since we only
196  // index into a single table
197  }
199 
201  void PrintSelf(std::ostream & os, Indent indent) const;
202 
204  void BeforeThreadedGenerateData();
205 
208  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
209  ThreadIdType threadId);
210 
217  virtual void GenerateInputRequestedRegion()
219 
220 private:
221  BilateralImageFilter(const Self &); //purposely not implemented
222  void operator=(const Self &); //purposely not implemented
223 
226  double m_RangeSigma;
227 
230  ArrayType m_DomainSigma;
231 
234  double m_DomainMu;
235  double m_RangeMu;
236 
238  unsigned int m_FilterDimensionality;
239 
241  KernelType m_GaussianKernel;
242  SizeType m_Radius;
243  bool m_AutomaticKernelSize;
244 
246  unsigned long m_NumberOfRangeGaussianSamples;
247  double m_DynamicRange;
248  double m_DynamicRangeUsed;
249  std::vector< double > m_RangeGaussianTable;
250 };
251 } // end namespace itk
252 
253 #ifndef ITK_MANUAL_INSTANTIATION
254 #include "itkBilateralImageFilter.hxx"
255 #endif
256 
257 #endif
258