ITK  5.4.0
Insight Toolkit
itkThresholdSegmentationLevelSetFunction.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 itkThresholdSegmentationLevelSetFunction_h
19#define itkThresholdSegmentationLevelSetFunction_h
20
22#include "itkNumericTraits.h"
23namespace itk
24{
56template <typename TImageType, typename TFeatureImageType = TImageType>
58 : public SegmentationLevelSetFunction<TImageType, TFeatureImageType>
59{
60public:
61 ITK_DISALLOW_COPY_AND_MOVE(ThresholdSegmentationLevelSetFunction);
62
68 using FeatureImageType = TFeatureImageType;
69
71 itkNewMacro(Self);
72
74 itkOverrideGetNameOfClassMacro(ThresholdSegmentationLevelSetFunction);
75
77 using typename Superclass::ImageType;
78 using typename Superclass::ScalarValueType;
79 using typename Superclass::FeatureScalarType;
80 using typename Superclass::RadiusType;
81
83 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
84
86 void
88 {
89 m_UpperThreshold = f;
90 }
91 FeatureScalarType
93 {
94 return m_UpperThreshold;
95 }
96 void
98 {
99 m_LowerThreshold = f;
100 }
101 FeatureScalarType
103 {
104 return m_LowerThreshold;
105 }
108 void
110
111 void
112 Initialize(const RadiusType & r) override
113 {
114 Superclass::Initialize(r);
115
116 this->SetAdvectionWeight(ScalarValueType{});
117 this->SetPropagationWeight(-1.0 * NumericTraits<ScalarValueType>::OneValue());
118 this->SetCurvatureWeight(NumericTraits<ScalarValueType>::OneValue());
119 }
120
123 void
125 {
126 m_EdgeWeight = p;
127 }
128
129 ScalarValueType
131 {
132 return m_EdgeWeight;
133 }
134
138 void
140 {
141 m_SmoothingConductance = p;
142 }
143
144 ScalarValueType
146 {
147 return m_SmoothingConductance;
148 }
149
153 void
155 {
156 m_SmoothingIterations = p;
157 }
158
159 int
161 {
162 return m_SmoothingIterations;
163 }
164
168 void
170 {
171 m_SmoothingTimeStep = i;
172 }
173
174 ScalarValueType
176 {
177 return m_SmoothingTimeStep;
178 }
179
180protected:
182 {
183 m_UpperThreshold = NumericTraits<FeatureScalarType>::max();
185 this->SetAdvectionWeight(0.0);
186 this->SetPropagationWeight(1.0);
187 this->SetCurvatureWeight(1.0);
188 this->SetSmoothingIterations(5);
189 this->SetSmoothingConductance(0.8);
190 this->SetSmoothingTimeStep(0.1);
191 this->SetEdgeWeight(0.0);
192 }
193
195
196 void
197 PrintSelf(std::ostream & os, Indent indent) const override
198 {
199 Superclass::PrintSelf(os, indent);
200 os << indent << "UpperThreshold: " << m_UpperThreshold << std::endl;
201 os << indent << "LowerThreshold: " << m_LowerThreshold << std::endl;
202 os << indent << "EdgeWeight: " << m_EdgeWeight << std::endl;
203 os << indent << "SmoothingTimeStep: " << m_SmoothingTimeStep << std::endl;
204 os << indent << "SmoothingIterations: " << m_SmoothingIterations << std::endl;
205 os << indent << "SmoothingConductance: " << m_SmoothingConductance << std::endl;
206 }
207
208 FeatureScalarType m_UpperThreshold{};
209 FeatureScalarType m_LowerThreshold{};
210 ScalarValueType m_EdgeWeight{};
211 ScalarValueType m_SmoothingConductance{};
212 int m_SmoothingIterations{};
213 ScalarValueType m_SmoothingTimeStep{};
214};
215} // end namespace itk
216
217#ifndef ITK_MANUAL_INSTANTIATION
218# include "itkThresholdSegmentationLevelSetFunction.hxx"
219#endif
220
221#endif
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Define additional traits for native types such as int or float.
static constexpr T NonpositiveMin()
static constexpr T max(const T &)
This function is used in ThresholdSegmentationLevelSetImageFilter to segment structures in images bas...
~ThresholdSegmentationLevelSetFunction() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....