ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkGaborKernelFunction.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkGaborKernelFunction_h
19#define itkGaborKernelFunction_h
20
22#include <cmath>
23
24namespace itk
25{
45template <typename TRealValueType>
46class ITK_TEMPLATE_EXPORT GaborKernelFunction : public KernelFunctionBase<TRealValueType>
47{
48public:
49 ITK_DISALLOW_COPY_AND_MOVE(GaborKernelFunction);
50
55
57 itkNewMacro(Self);
58
60 itkOverrideGetNameOfClassMacro(GaborKernelFunction);
61
63 TRealValueType
64 Evaluate(const TRealValueType & u) const override
65 {
66 TRealValueType parameter = itk::Math::sqr(u / this->m_Sigma);
67 TRealValueType envelope = std::exp(TRealValueType{ -0.5 } * parameter);
68 TRealValueType phase = TRealValueType{ 2.0 * itk::Math::pi } * this->m_Frequency * u + this->m_PhaseOffset;
70
72 {
73 return envelope * std::sin(phase);
74 }
75
76 return envelope * std::cos(phase);
77 }
78
80 itkSetMacro(Sigma, TRealValueType);
81 itkGetConstMacro(Sigma, TRealValueType);
83
85 itkSetMacro(Frequency, TRealValueType);
86 itkGetConstMacro(Frequency, TRealValueType);
88
90 itkSetMacro(PhaseOffset, TRealValueType);
91 itkGetConstMacro(PhaseOffset, TRealValueType);
93
96 itkSetMacro(CalculateImaginaryPart, bool);
97 itkGetConstMacro(CalculateImaginaryPart, bool);
98 itkBooleanMacro(CalculateImaginaryPart);
100
101protected:
103 {
104 this->m_CalculateImaginaryPart = false;
105 this->m_Sigma = TRealValueType{ 1.0 };
106 this->m_Frequency = TRealValueType{ 0.4 };
107 this->m_PhaseOffset = TRealValueType{ 0.0 };
108 }
109 ~GaborKernelFunction() override = default;
110 void
111 PrintSelf(std::ostream & os, Indent indent) const override
112 {
113 Superclass::PrintSelf(os, indent);
114
115 os << indent << "Sigma: " << this->GetSigma() << std::endl;
116 os << indent << "Frequency: " << this->GetFrequency() << std::endl;
117 os << indent << "PhaseOffset: " << this->GetPhaseOffset() << std::endl;
118 os << indent << "CalculateImaginaryPart: " << this->GetCalculateImaginaryPart() << std::endl;
119 }
120
121private:
122 TRealValueType m_Sigma{};
123
124 TRealValueType m_Frequency{};
125
126 TRealValueType m_PhaseOffset{};
127
129};
130} // end namespace itk
131
132#endif
virtual bool GetCalculateImaginaryPart() const
KernelFunctionBase< TRealValueType > Superclass
~GaborKernelFunction() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
TRealValueType Evaluate(const TRealValueType &u) const override
virtual TRealValueType GetFrequency() const
virtual TRealValueType GetPhaseOffset() const
virtual TRealValueType GetSigma() const
Control indentation during Print() invocation.
Definition itkIndent.h:50
virtual void PrintSelf(std::ostream &os, Indent indent) const
Implements transparent reference counting.
static constexpr double pi
Definition itkMath.h:66
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....