ITK  5.2.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  * http://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 
75 
77  using ImageType = typename Superclass::ImageType;
80  using RadiusType = 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  }
107 
108  void
109  CalculateSpeedImage() override;
110 
111  void
112  Initialize(const RadiusType & r) override
113  {
114  Superclass::Initialize(r);
115 
116  this->SetAdvectionWeight(NumericTraits<ScalarValueType>::ZeroValue());
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 
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:97
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::FiniteDifferenceFunction::ImageType
TImageType ImageType
Definition: itkFiniteDifferenceFunction.h:82
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::ThresholdSegmentationLevelSetFunction::m_SmoothingConductance
ScalarValueType m_SmoothingConductance
Definition: itkThresholdSegmentationLevelSetFunction.h:211
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
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::SegmentationLevelSetFunction::ScalarValueType
typename Superclass::ScalarValueType ScalarValueType
Definition: itkSegmentationLevelSetFunction.h:67
itk::ThresholdSegmentationLevelSetFunction::SetSmoothingConductance
void SetSmoothingConductance(const ScalarValueType p)
Definition: itkThresholdSegmentationLevelSetFunction.h:139
itk::ThresholdSegmentationLevelSetFunction::m_LowerThreshold
FeatureScalarType m_LowerThreshold
Definition: itkThresholdSegmentationLevelSetFunction.h:209
itk::ThresholdSegmentationLevelSetFunction::SetEdgeWeight
void SetEdgeWeight(const ScalarValueType p)
Definition: itkThresholdSegmentationLevelSetFunction.h:124
itk::ThresholdSegmentationLevelSetFunction::GetLowerThreshold
FeatureScalarType GetLowerThreshold() const
Definition: itkThresholdSegmentationLevelSetFunction.h:102
itk::ThresholdSegmentationLevelSetFunction::m_EdgeWeight
ScalarValueType m_EdgeWeight
Definition: itkThresholdSegmentationLevelSetFunction.h:210
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:58
itk::NumericTraits::max
static constexpr T max(const T &)
Definition: itkNumericTraits.h:167
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: itkAnnulusOperator.h:24
itk::ThresholdSegmentationLevelSetFunction::m_SmoothingIterations
int m_SmoothingIterations
Definition: itkThresholdSegmentationLevelSetFunction.h:212
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::m_UpperThreshold
FeatureScalarType m_UpperThreshold
Definition: itkThresholdSegmentationLevelSetFunction.h:208
itk::ThresholdSegmentationLevelSetFunction::m_SmoothingTimeStep
ScalarValueType m_SmoothingTimeStep
Definition: itkThresholdSegmentationLevelSetFunction.h:213
itk::ThresholdSegmentationLevelSetFunction::SetUpperThreshold
void SetUpperThreshold(FeatureScalarType f)
Definition: itkThresholdSegmentationLevelSetFunction.h:87