ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkDiscreteGaussianImageFilter.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 itkDiscreteGaussianImageFilter_h
19 #define itkDiscreteGaussianImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkImage.h"
23 
24 namespace itk
25 {
61 template< typename TInputImage, typename TOutputImage >
62 class ITK_TEMPLATE_EXPORT DiscreteGaussianImageFilter:
63  public ImageToImageFilter< TInputImage, TOutputImage >
64 {
65 public:
71 
73  itkNewMacro(Self);
74 
77 
79  typedef TInputImage InputImageType;
80  typedef TOutputImage OutputImageType;
81 
84  typedef typename TOutputImage::PixelType OutputPixelType;
85  typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
86  typedef typename TInputImage::PixelType InputPixelType;
87  typedef typename TInputImage::InternalPixelType InputInternalPixelType;
88 
92 
95  itkStaticConstMacro(ImageDimension, unsigned int,
96  TOutputImage::ImageDimension);
97 
100 
107  itkSetMacro(Variance, ArrayType);
108  itkGetConstMacro(Variance, const ArrayType);
110 
114  itkSetMacro(MaximumError, ArrayType);
115  itkGetConstMacro(MaximumError, const ArrayType);
117 
120  itkGetConstMacro(MaximumKernelWidth, int);
121  itkSetMacro(MaximumKernelWidth, int);
123 
129  itkGetConstMacro(FilterDimensionality, unsigned int);
130  itkSetMacro(FilterDimensionality, unsigned int);
132 
135  void SetVariance(const typename ArrayType::ValueType v)
136  {
137  m_Variance.Fill(v);
138  this->Modified();
139  }
141 
142  void SetMaximumError(const typename ArrayType::ValueType v)
143  {
144  m_MaximumError.Fill(v);
145  this->Modified();
146  }
147 
148  void SetVariance(const double *v)
149  {
150  ArrayType dv;
151 
152  for ( unsigned int i = 0; i < ImageDimension; i++ )
153  {
154  dv[i] = v[i];
155  }
156  this->SetVariance(dv);
157  }
158 
159  void SetVariance(const float *v)
160  {
161  ArrayType dv;
162 
163  for ( unsigned int i = 0; i < ImageDimension; i++ )
164  {
165  dv[i] = v[i];
166  }
167  this->SetVariance(dv);
168  }
169 
170  void SetMaximumError(const double *v)
171  {
172  ArrayType dv;
173 
174  for ( unsigned int i = 0; i < ImageDimension; i++ )
175  {
176  dv[i] = v[i];
177  }
178  this->SetMaximumError(dv);
179  }
180 
181  void SetMaximumError(const float *v)
182  {
183  ArrayType dv;
184 
185  for ( unsigned int i = 0; i < ImageDimension; i++ )
186  {
187  dv[i] = v[i];
188  }
189  this->SetMaximumError(dv);
190  }
191 
196  { this->SetUseImageSpacing(true); }
197 
201  { this->SetUseImageSpacing(false); }
202 
205  itkSetMacro(UseImageSpacing, bool);
206  itkGetConstMacro(UseImageSpacing, bool);
208 
218  itkSetMacro(InternalNumberOfStreamDivisions, unsigned int);
219  itkGetConstReferenceMacro(InternalNumberOfStreamDivisions, unsigned int);
220 
227  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
228 
229 #ifdef ITK_USE_CONCEPT_CHECKING
230  // Begin concept checking
231 
232  itkConceptMacro( OutputHasNumericTraitsCheck,
234 
235  // End concept checking
236 #endif
237 
238 protected:
240  {
241  m_Variance.Fill(0.0);
242  m_MaximumError.Fill(0.01);
243  m_MaximumKernelWidth = 32;
244  m_UseImageSpacing = true;
245  m_FilterDimensionality = ImageDimension;
246  m_InternalNumberOfStreamDivisions = ImageDimension * ImageDimension;
247  }
248 
249  virtual ~DiscreteGaussianImageFilter() ITK_OVERRIDE {}
250  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
251 
257  void GenerateData() ITK_OVERRIDE;
258 
259 private:
260  ITK_DISALLOW_COPY_AND_ASSIGN(DiscreteGaussianImageFilter);
261 
264  ArrayType m_Variance;
265 
269  ArrayType m_MaximumError;
270 
273  int m_MaximumKernelWidth;
274 
276  unsigned int m_FilterDimensionality;
277 
279  bool m_UseImageSpacing;
280 
283  unsigned int m_InternalNumberOfStreamDivisions;
284 };
285 } // end namespace itk
286 
287 #ifndef ITK_MANUAL_INSTANTIATION
288 #include "itkDiscreteGaussianImageFilter.hxx"
289 #endif
290 
291 #endif
ImageToImageFilter< TInputImage, TOutputImage > Superclass
TOutputImage::InternalPixelType OutputInternalPixelType
Base class for all process objects that output image data.
void SetVariance(const typename ArrayType::ValueType v)
NumericTraits< InputPixelType >::ValueType InputPixelValueType
NumericTraits< OutputPixelType >::ValueType OutputPixelValueType
FixedArray< double, itkGetStaticConstMacro(ImageDimension) > ArrayType
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
TInputImage::InternalPixelType InputInternalPixelType
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)
Blurs an image by separable convolution with discrete gaussian kernels. This filter performs Gaussian...
void SetMaximumError(const typename ArrayType::ValueType v)