ITK  4.2.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< class TInputImage, class TOutputImage >
62 class ITK_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 
195  void SetUseImageSpacingOn()
196  { this->SetUseImageSpacing(true); }
197 
200  void SetUseImageSpacingOff()
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()
229 
230 #ifdef ITK_USE_CONCEPT_CHECKING
231 
233  itkConceptMacro( OutputHasNumericTraitsCheck,
235 
237 #endif
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  }
249 
251  void PrintSelf(std::ostream & os, Indent indent) const;
252 
258  void GenerateData();
259 
260 private:
261  DiscreteGaussianImageFilter(const Self &); //purposely not implemented
262  void operator=(const Self &); //purposely not implemented
263 
267 
272 
276 
279 
282 
286 };
287 } // end namespace itk
288 
289 #ifndef ITK_MANUAL_INSTANTIATION
290 #include "itkDiscreteGaussianImageFilter.hxx"
291 #endif
292 
293 #endif
294