NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkLewisGriffinRecursiveGaussianImageFilter.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkLewisGriffinRecursiveGaussianImageFilter_h
16 #define itkLewisGriffinRecursiveGaussianImageFilter_h
17 
18 #include <itkImageToImageFilter.h>
19 #include <itkNumericTraits.h>
20 
21 namespace itk
22 {
23 
29 template <typename TInputImage, typename TOutputImage=TInputImage>
31  public ImageToImageFilter<TInputImage,TOutputImage>
32 {
33 public:
36  typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
37  typedef SmartPointer<Self> Pointer;
38  typedef SmartPointer<const Self> ConstPointer;
39 
41  itkNewMacro(Self);
42 
44  itkTypeMacro( LewisGriffinRecursiveGaussianImageFilter, ImageToImageFilter );
45 
47  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
48 
50  typedef typename TInputImage::Pointer InputImagePointer;
51  typedef typename TInputImage::ConstPointer InputImageConstPointer;
52 
59  typedef typename NumericTraits<InputPixelType>::RealType RealType;
60  typedef typename NumericTraits<InputPixelType>::ScalarRealType ScalarRealType;
61 
63 
65  typedef TInputImage InputImageType;
66 
68  typedef TOutputImage OutputImageType;
69 
71  itkGetConstMacro(Direction, unsigned int);
72 
74  itkSetMacro(Direction, unsigned int);
75 
77  void SetInputImage( const TInputImage * );
78 
80  const TInputImage * GetInputImage( void );
81 
83  typedef unsigned char MaskPixelType;
84  typedef typename itk::Image<MaskPixelType, ImageDimension> MaskImageType;
85  typedef typename MaskImageType::Pointer MaskImagePointer;
86 
88  itkSetObjectMacro( Mask, MaskImageType );
89 
90 
93  itkGetConstMacro( Sigma, ScalarRealType );
94  itkSetMacro( Sigma, ScalarRealType );
95 
99  typedef enum { ZeroOrder, FirstOrder, SecondOrder } OrderEnumType;
100 
107  itkSetMacro( Order, OrderEnumType );
108  itkGetConstMacro( Order, OrderEnumType );
109 
111  void SetZeroOrder();
112 
114  void SetFirstOrder();
115 
117  void SetSecondOrder();
118 
120  void SetSingleThreadedExecution(void) {m_FlagMultiThreadedExecution = false;}
121 
122 protected:
125 
126  LewisGriffinRecursiveGaussianImageFilter(const Self&); //purposely not implemented
127  void operator=(const Self&); //purposely not implemented
128 
129  void PrintSelf(std::ostream& os, Indent indent) const;
130 
133  {
135  };
136 
139 
141  void BeforeThreadedGenerateData();
142  void GenerateData(void);
143  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId );
144 
145  int SplitRequestedRegion(int i, int num, OutputImageRegionType& splitRegion);
146 
155  void EnlargeOutputRequestedRegion(DataObject *output);
156 
161  virtual void SetUp(ScalarRealType spacing);
162 
165  void FilterDataArray(RealType *outs, RealType *data, int ln);
166 
168  RealType GaussianZeroOrder(RealType x, RealType sigma);
170  RealType GaussianFirstOrder(RealType x, RealType sigma);
172  RealType GaussianSecondOrder(RealType x, RealType sigma);
173 
176  unsigned int m_Direction;
177 
179  ScalarRealType m_Sigma;
180 
183 
185  RealType *m_Kernel;
186 
188  unsigned int m_KernelSize;
189 
191  MaskImagePointer m_Mask;
192 };
193 
194 
195 } // end namespace itk
196 
197 #ifndef ITK_MANUAL_INSTANTIATION
198 #include "itkLewisGriffinRecursiveGaussianImageFilter.txx"
199 #endif
200 
201 
202 #endif
TInputImage::PixelType InputPixelType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:58
TInputImage::ConstPointer InputImageConstPointer
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:51
Definition: niftkITKAffineResampleImage.cxx:74
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Definition: glew.h:1363
MaskImageType::Pointer MaskImagePointer
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:85
RealType * m_Kernel
The Gaussian kernel.
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:185
unsigned int m_Direction
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:176
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:99
NumericTraits< InputPixelType >::ScalarRealType ScalarRealType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:60
unsigned char MaskPixelType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:83
ScalarRealType m_Sigma
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:179
Lewis Griffin's implementation of a recursive Gaussian filter which does not produce the oscillations...
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:30
LewisGriffinRecursiveGaussianImageFilter * Filter
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:134
GLuint num
Definition: glew.h:2607
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
LewisGriffinRecursiveGaussianImageFilter Self
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:35
NumericTraits< InputPixelType >::RealType RealType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:59
void SetSingleThreadedExecution(void)
For debugging purposes, set single threaded execution.
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:120
OrderEnumType m_Order
Gaussian kernel order.
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:182
MaskImagePointer m_Mask
Optional mask image.
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:191
GLint GLint GLint GLint GLint x
Definition: glew.h:1236
TInputImage InputImageType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:65
bool m_FlagMultiThreadedExecution
Flag to turn multithreading on or off.
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:138
TOutputImage OutputImageType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:68
SmartPointer< const Self > ConstPointer
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:38
unsigned int m_KernelSize
The size of the kernel.
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:188
SmartPointer< Self > Pointer
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:37
TInputImage::Pointer InputImagePointer
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:50
OrderEnumType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:99
TOutputImage::RegionType OutputImageRegionType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:62
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:36
itk::Image< MaskPixelType, ImageDimension > MaskImageType
Definition: itkLewisGriffinRecursiveGaussianImageFilter.h:84