-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitkNLMFilter.h
124 lines (102 loc) · 4.74 KB
/
itkNLMFilter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkNLMFilter.h,v $
Language: C++
Date: $Date: 2006/03/27 17:01:10 $
Version: $Revision: 1.15 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkNLMFilter_h
#define __itkNLMFilter_h
#include "itkImageToImageFilter.h"
#include "LSDerivatives/itkLSDerivatives.h"
#include "itkImage.h"
namespace itk
{
/** \class NLMFilter
*
* DO NOT assume a particular image or pixel type, which is, the input image
* may be a VectorImage as well as an Image obeject with vectorial pixel type.
*
* \sa Image
*/
template <class TInputImage, class TOutputImage>
class ITK_EXPORT NLMFilter : public ImageToImageFilter< TInputImage, TOutputImage >
{
public:
/** Standard class typedefs. */
typedef NLMFilter Self;
/** Convenient typedefs for simplifying declarations. */
typedef TInputImage InputImageType;
typedef typename InputImageType::Pointer InputImagePointer;
typedef typename InputImageType::ConstPointer InputImageConstPointer;
typedef TOutputImage OutputImageType;
typedef typename OutputImageType::Pointer OutputImagePointer;
/** Standard class typedefs. */
typedef ImageToImageFilter< InputImageType, OutputImageType> Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro( NLMFilter, ImageToImageFilter );
/** Image typedef support. */
typedef typename InputImageType::PixelType InputPixelType;
typedef typename OutputImageType::PixelType OutputPixelType;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename InputImageType::SizeType InputImageSizeType;
typedef typename InputImageType::IndexType InputImageIndexType;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef itk::Image< LSGradientsL2, TInputImage::ImageDimension > FeaturesMapType;
typedef typename FeaturesMapType::Pointer FeaturesMapPointer;
typedef itk::LSDerivativesL0<InputImageType> L0Type;
typedef typename L0Type::Pointer L0Pointer;
typedef itk::LSDerivativesL1<TInputImage::ImageDimension> L1Type;
typedef typename L1Type::Pointer L1Pointer;
typedef itk::LSDerivativesL2<TInputImage::ImageDimension> L2Type;
typedef typename L2Type::Pointer L2Pointer;
itkSetMacro( Sigma, float );
itkGetMacro( Sigma, float );
itkSetMacro( H, float );
itkGetMacro( H, float );
itkSetMacro( PSTh, float );
itkGetMacro( PSTh, float );
itkSetMacro( RSearch, InputImageSizeType );
itkGetMacro( RSearch, InputImageSizeType );
itkSetMacro( RComp, InputImageSizeType );
itkGetMacro( RComp, InputImageSizeType );
protected:
NLMFilter();
~NLMFilter() override;
// Threaded filter:
#if ITK_VERSION_MAJOR < 4
void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, int threadId );
#else
void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId ) override;
#endif
void GenerateInputRequestedRegion() override;
void BeforeThreadedGenerateData( void ) override;
void PrintSelf( std::ostream &os, Indent indent ) const override;
private:
NLMFilter(const Self&); // purposely not implemented
void operator=(const Self&); // purposely not implemented
float ComputeTraceMO0( const InputImageSizeType& rcomp );
float ComputeTraceMO1( const InputImageSizeType& rcomp );
// The standard deviation of noise (in the complex domain)
float m_Sigma;
// The true parameteres of NLM:
float m_H;
float m_PSTh;
InputImageSizeType m_RSearch;
InputImageSizeType m_RComp;
FeaturesMapPointer m_Features;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkNLMFilter.txx"
#endif
#endif