ITK  6.0.0
Insight Toolkit
itkGPUAnisotropicDiffusionFunction.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 itkGPUAnisotropicDiffusionFunction_h
19#define itkGPUAnisotropicDiffusionFunction_h
20
22
23namespace itk
24{
37template <typename TImage>
38class ITK_TEMPLATE_EXPORT GPUAnisotropicDiffusionFunction : public GPUFiniteDifferenceFunction<TImage>
39{
40public:
41 ITK_DISALLOW_COPY_AND_MOVE(GPUAnisotropicDiffusionFunction);
42
48
50 itkOverrideGetNameOfClassMacro(GPUAnisotropicDiffusionFunction);
51
53 using typename Superclass::ImageType;
54 using typename Superclass::PixelType;
56 using typename Superclass::RadiusType;
57 using typename Superclass::NeighborhoodType;
58 using typename Superclass::TimeStepType;
59 using typename Superclass::FloatOffsetType;
60
62 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
63
69 virtual void
71
75 void
77 {
78 m_TimeStep = t;
79 }
80
81 const TimeStepType &
83 {
84 return m_TimeStep;
85 }
86
88 void
90 {
91 m_ConductanceParameter = c;
92 }
93
94 const double &
96 {
97 return m_ConductanceParameter;
98 }
99
101 const double &
103 {
104 return m_AverageGradientMagnitudeSquared;
105 }
106
107 void
109 {
110 m_AverageGradientMagnitudeSquared = c;
111 }
112
115 TimeStepType
116 ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const override
117 {
118 return this->GetTimeStep();
119 }
120
123 void *
124 GetGlobalDataPointer() const override
125 {
126 return nullptr;
127 }
128
130 void
131 ReleaseGlobalDataPointer(void * itkNotUsed(GlobalData)) const override
132 {
133 /* do nothing */
134 }
135
136protected:
138 {
139 m_AverageGradientMagnitudeSquared = 0.0;
140 m_ConductanceParameter = 1.0; // default value
141 m_TimeStep = 0.125f; // default value
142 }
143
145
146 void
147 PrintSelf(std::ostream & os, Indent indent) const override
148 {
149 Superclass::PrintSelf(os, indent);
150 os << indent << "TimeStep: " << m_TimeStep << std::endl;
151 os << indent << "ConductanceParameter: " << m_ConductanceParameter << std::endl;
152 }
153
154 // GPU buffer for Computing Average Squared Gradient Magnitude
155 typename GPUDataManager::Pointer m_AnisotropicDiffusionFunctionGPUBuffer{};
156 typename GPUKernelManager::Pointer m_AnisotropicDiffusionFunctionGPUKernelManager{};
157
158 // GPU Kernel Handles
159 int m_AverageGradientMagnitudeSquaredGPUKernelHandle{};
160
161private:
162 double m_AverageGradientMagnitudeSquared{};
163 double m_ConductanceParameter{};
164 TimeStepType m_TimeStep{};
165};
166} // end namespace itk
167
168#endif
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
typename ConstNeighborhoodIterator< TImage >::RadiusType RadiusType
TimeStepType ComputeGlobalTimeStep(void *) const override
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void GPUCalculateAverageGradientMagnitudeSquared(ImageType *)=0
typename Superclass::PixelRealType PixelrealType
~GPUAnisotropicDiffusionFunction() override=default
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:63
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....