ITK  6.0.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"
23 namespace itk
24 {
56 template <typename TImageType, typename TFeatureImageType = TImageType>
57 class ITK_TEMPLATE_EXPORT ThresholdSegmentationLevelSetFunction
58  : public SegmentationLevelSetFunction<TImageType, TFeatureImageType>
59 {
60 public:
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
109  CalculateSpeedImage() override;
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 
180 protected:
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 
194  ~ThresholdSegmentationLevelSetFunction() override = default;
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
itk::FiniteDifferenceFunction::RadiusType
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
Definition: itkFiniteDifferenceFunction.h:97
itk::NumericTraits::NonpositiveMin
static constexpr T NonpositiveMin()
Definition: itkNumericTraits.h:99
itk::ThresholdSegmentationLevelSetFunction::ThresholdSegmentationLevelSetFunction
ThresholdSegmentationLevelSetFunction()
Definition: itkThresholdSegmentationLevelSetFunction.h:181
itk::ThresholdSegmentationLevelSetFunction::SetLowerThreshold
void SetLowerThreshold(FeatureScalarType f)
Definition: itkThresholdSegmentationLevelSetFunction.h:97
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ThresholdSegmentationLevelSetFunction::SetSmoothingTimeStep
void SetSmoothingTimeStep(const ScalarValueType i)
Definition: itkThresholdSegmentationLevelSetFunction.h:169
itk::ThresholdSegmentationLevelSetFunction::GetSmoothingIterations
int GetSmoothingIterations() const
Definition: itkThresholdSegmentationLevelSetFunction.h:160
itk::ThresholdSegmentationLevelSetFunction::GetSmoothingConductance
ScalarValueType GetSmoothingConductance() const
Definition: itkThresholdSegmentationLevelSetFunction.h:145
itk::SegmentationLevelSetFunction::FeatureImageType
TFeatureImageType FeatureImageType
Definition: itkSegmentationLevelSetFunction.h:65
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkSegmentationLevelSetFunction.h
itk::SegmentationLevelSetFunction::FeatureScalarType
typename FeatureImageType::PixelType FeatureScalarType
Definition: itkSegmentationLevelSetFunction.h:69
itk::ThresholdSegmentationLevelSetFunction::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
Definition: itkThresholdSegmentationLevelSetFunction.h:197
itk::ThresholdSegmentationLevelSetFunction::SetSmoothingConductance
void SetSmoothingConductance(const ScalarValueType p)
Definition: itkThresholdSegmentationLevelSetFunction.h:139
itk::ThresholdSegmentationLevelSetFunction::SetEdgeWeight
void SetEdgeWeight(const ScalarValueType p)
Definition: itkThresholdSegmentationLevelSetFunction.h:124
itk::ThresholdSegmentationLevelSetFunction::GetLowerThreshold
FeatureScalarType GetLowerThreshold() const
Definition: itkThresholdSegmentationLevelSetFunction.h:102
itk::ThresholdSegmentationLevelSetFunction
This function is used in ThresholdSegmentationLevelSetImageFilter to segment structures in images bas...
Definition: itkThresholdSegmentationLevelSetFunction.h:57
itk::ThresholdSegmentationLevelSetFunction::SetSmoothingIterations
void SetSmoothingIterations(const int p)
Definition: itkThresholdSegmentationLevelSetFunction.h:154
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::NumericTraits::max
static constexpr T max(const T &)
Definition: itkNumericTraits.h:169
itk::LevelSetFunction::ScalarValueType
PixelType ScalarValueType
Definition: itkLevelSetFunction.h:90
itk::ThresholdSegmentationLevelSetFunction::GetEdgeWeight
ScalarValueType GetEdgeWeight() const
Definition: itkThresholdSegmentationLevelSetFunction.h:130
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ThresholdSegmentationLevelSetFunction::Initialize
void Initialize(const RadiusType &r) override
Definition: itkThresholdSegmentationLevelSetFunction.h:112
itk::ThresholdSegmentationLevelSetFunction::GetUpperThreshold
FeatureScalarType GetUpperThreshold() const
Definition: itkThresholdSegmentationLevelSetFunction.h:92
itk::ThresholdSegmentationLevelSetFunction::GetSmoothingTimeStep
ScalarValueType GetSmoothingTimeStep() const
Definition: itkThresholdSegmentationLevelSetFunction.h:175
itk::SegmentationLevelSetFunction
Definition: itkSegmentationLevelSetFunction.h:47
itkNumericTraits.h
itk::ThresholdSegmentationLevelSetFunction::SetUpperThreshold
void SetUpperThreshold(FeatureScalarType f)
Definition: itkThresholdSegmentationLevelSetFunction.h:87