ANIMA  4.0
animaNonLocalMeansImageFilter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
5 #include <itkVectorImage.h>
6 #include <itkImage.h>
7 #include <itkVector.h>
8 #include <itkObject.h>
9 
10 
11 namespace anima
12 {
13 
14 template <class TInputImage >
16  public anima::NumberedThreadImageToImageFilter <TInputImage, TInputImage>
17 {
18 public:
19 
21  typedef typename TInputImage::PixelType InputPixelType;
22  typedef InputPixelType OutputPixelType;
23 
25  typedef TInputImage InputImageType;
26  typedef typename InputImageType::Pointer InputImagePointer;
27  typedef typename InputImageType::RegionType InputImageRegionType;
28  typedef typename InputImageType::IndexType InputImageIndexType;
29 
30  typedef InputImageType OutputImageType;
31  typedef typename OutputImageType::Pointer OutputImagePointer;
32  typedef typename OutputImageType::RegionType OutputImageRegionType;
33 
37 
39  typedef itk::SmartPointer<Self> Pointer;
40  typedef itk::SmartPointer<const Self> ConstPointer;
41 
43  itkNewMacro(Self)
44 
45 
47 
48 
49  itkStaticConstMacro(InputImageDimension, unsigned int,
50  TInputImage::ImageDimension);
51  itkStaticConstMacro(OutputImageDimension, unsigned int,
52  TInputImage::ImageDimension);
53 
54 
56  enum WEIGHT
57  {
59  };
60 
61  itkSetMacro(PatchHalfSize, unsigned int)
62  itkSetMacro(SearchNeighborhood, unsigned int)
63  itkSetMacro(SearchStepSize, unsigned int)
64  itkSetMacro(WeightThreshold, double)
65  itkSetMacro(BetaParameter, double)
66  itkSetMacro(MeanMinThreshold, double)
67  itkSetMacro(VarMinThreshold, double)
68  itkSetMacro(WeightMethod, WEIGHT)
69 
70 protected:
72  m_MeanMinThreshold(0.95),
73  m_VarMinThreshold(0.5),
74  m_WeightThreshold(0.0),
75  m_BetaParameter(1.0),
76  m_PatchHalfSize(3),
77  m_SearchStepSize(3),
78  m_SearchNeighborhood(6),
79  m_WeightMethod(EXP),
80  m_localNeighborhood(1)
81 
82  {}
83 
85 
86  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) ITK_OVERRIDE;
87  void BeforeThreadedGenerateData() ITK_OVERRIDE;
88 
89 private:
90  ITK_DISALLOW_COPY_AND_ASSIGN(NonLocalMeansImageFilter);
91 
92  void computeAverageLocalVariance();
93  void computeMeanAndVarImages();
94 
95  double m_MeanMinThreshold;
96  double m_VarMinThreshold;
97  double m_WeightThreshold;
98  double m_BetaParameter;
99 
100  unsigned int m_PatchHalfSize;
101  unsigned int m_SearchStepSize;
102  unsigned int m_SearchNeighborhood;
103  WEIGHT m_WeightMethod;
104 
105  double m_noiseCovariance;
106  OutputImagePointer m_meanImage;
107  OutputImagePointer m_varImage;
108 
109  int m_localNeighborhood;
110 
111  int m_maxAbsDisp;
112 };
113 
114 } //end of namespace anima
115 
static const unsigned int OutputImageDimension
anima::NumberedThreadImageToImageFilter< InputImageType, OutputImageType > Superclass
Implements a class to handle thread number in a dynamic way for multithreaded methods needing thread ...
InputImageType::RegionType InputImageRegionType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE
OutputImageType::RegionType OutputImageRegionType
itk::SmartPointer< const Self > ConstPointer