ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkNormalVectorDiffusionFunction.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 itkNormalVectorDiffusionFunction_h
19#define itkNormalVectorDiffusionFunction_h
20
22#include "itkNumericTraits.h"
23#include <cmath>
24
25namespace itk
26{
59template <typename TSparseImageType>
60class ITK_TEMPLATE_EXPORT NormalVectorDiffusionFunction : public NormalVectorFunctionBase<TSparseImageType>
61{
62public:
63 ITK_DISALLOW_COPY_AND_MOVE(NormalVectorDiffusionFunction);
64
70
72 itkOverrideGetNameOfClassMacro(NormalVectorDiffusionFunction);
73
75 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
76
78 itkNewMacro(Self);
79
81 using typename Superclass::TimeStepType;
82 using typename Superclass::RadiusType;
83 using typename Superclass::NeighborhoodType;
85 using typename Superclass::FloatOffsetType;
86 using typename Superclass::IndexType;
87 using typename Superclass::SparseImageType;
88 using typename Superclass::NodeType;
89 using typename Superclass::NodeValueType;
90 using typename Superclass::NormalVectorType;
91
96 void
98 {
100 }
101
103 int
105 {
106 return m_NormalProcessType;
107 }
108
114 void
116 {
117 m_ConductanceParameter = cp + static_cast<NodeValueType>(0.001);
118 // we add a minimum conductance to avoid divide by zero
119 // can make this a parameter.
121 }
122
123
125 NodeValueType
127 {
129 }
130
132 NodeValueType
134 {
135 return m_FluxStopConstant;
136 }
137
142 void
144
147 ComputeSparseUpdate(NeighborhoodType & it, void * globalData, const FloatOffsetType & offset) const override;
148
149protected:
151 ~NormalVectorDiffusionFunction() override = default;
152 void
153 PrintSelf(std::ostream & os, Indent indent) const override;
154
159 {
160 // the slow exp function could be replaced with a lookup table
161 if (v <= 0.0)
162 {
164 }
165
166 return static_cast<NodeValueType>(std::exp(m_FluxStopConstant * v));
167 }
168
169private:
172
176
179};
180} // end namespace itk
181
182#ifndef ITK_MANUAL_INSTANTIATION
183# include "itkNormalVectorDiffusionFunction.hxx"
184#endif
185
186#endif
ConstNeighborhoodIterator< TSparseImageType, DefaultBoundaryConditionType > NeighborhoodType
Vector< PixelRealType, Self::ImageDimension > NeighborhoodScalesType
typename ConstNeighborhoodIterator< TSparseImageType >::RadiusType RadiusType
Control indentation during Print() invocation.
Definition itkIndent.h:50
NodeValueType FluxStopFunction(const NodeValueType v) const
typename NodeType::NodeValueType NodeValueType
NormalVectorType ComputeSparseUpdate(NeighborhoodType &it, void *globalData, const FloatOffsetType &offset) const override
typename NodeType::NodeDataType NormalVectorType
~NormalVectorDiffusionFunction() override=default
void PrecomputeSparseUpdate(NeighborhoodType &it) const override
void PrintSelf(std::ostream &os, Indent indent) const override
NormalVectorFunctionBase< TSparseImageType > Superclass
typename SparseImageType::NodeType NodeType
typename NodeType::NodeValueType NodeValueType
typename NodeType::NodeDataType NormalVectorType
static constexpr unsigned int ImageDimension
typename SparseImageType::IndexType IndexType
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....