ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkThresholdSegmentationLevelSetFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
55 template< typename TImageType, typename TFeatureImageType = TImageType >
56 class ITK_TEMPLATE_EXPORT ThresholdSegmentationLevelSetFunction:
57  public SegmentationLevelSetFunction< TImageType, TFeatureImageType >
58 {
59 public:
60  ITK_DISALLOW_COPY_AND_ASSIGN(ThresholdSegmentationLevelSetFunction);
61 
64  using Superclass =
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 
87  { m_UpperThreshold = f; }
89  { return m_UpperThreshold; }
91  { m_LowerThreshold = f; }
93  { return m_LowerThreshold; }
95 
96  void CalculateSpeedImage() override;
97 
98  void Initialize(const RadiusType & r) override
99  {
100  Superclass::Initialize(r);
101 
102  this->SetAdvectionWeight(NumericTraits< ScalarValueType >::ZeroValue());
103  this->SetPropagationWeight(-1.0 * NumericTraits< ScalarValueType >::OneValue());
104  this->SetCurvatureWeight(NumericTraits< ScalarValueType >::OneValue());
105  }
106 
110  {
111  m_EdgeWeight = p;
112  }
113 
115  {
116  return m_EdgeWeight;
117  }
118 
123  {
124  m_SmoothingConductance = p;
125  }
126 
128  {
129  return m_SmoothingConductance;
130  }
131 
135  void SetSmoothingIterations(const int p)
136  {
137  m_SmoothingIterations = p;
138  }
139 
141  {
142  return m_SmoothingIterations;
143  }
144 
149  {
150  m_SmoothingTimeStep = i;
151  }
152 
154  {
155  return m_SmoothingTimeStep;
156  }
157 
158 protected:
160  {
161  m_UpperThreshold = NumericTraits< FeatureScalarType >::max();
163  this->SetAdvectionWeight(0.0);
164  this->SetPropagationWeight(1.0);
165  this->SetCurvatureWeight(1.0);
166  this->SetSmoothingIterations(5);
167  this->SetSmoothingConductance(0.8);
168  this->SetSmoothingTimeStep(0.1);
169  this->SetEdgeWeight(0.0);
170  }
171 
172  ~ThresholdSegmentationLevelSetFunction() override = default;
173 
174  void PrintSelf(std::ostream & os, Indent indent) const override
175  {
176  Superclass::PrintSelf(os, indent);
177  os << indent << "UpperThreshold: " << m_UpperThreshold << std::endl;
178  os << indent << "LowerThreshold: " << m_LowerThreshold << std::endl;
179  os << indent << "EdgeWeight: " << m_EdgeWeight << std::endl;
180  os << indent << "SmoothingTimeStep: " << m_SmoothingTimeStep << std::endl;
181  os << indent << "SmoothingIterations: " << m_SmoothingIterations << std::endl;
182  os << indent << "SmoothingConductance: " << m_SmoothingConductance << std::endl;
183  }
184 
191 };
192 } // end namespace itk
193 
194 #ifndef ITK_MANUAL_INSTANTIATION
195 #include "itkThresholdSegmentationLevelSetFunction.hxx"
196 #endif
197 
198 #endif
Light weight base class for most itk classes.
typename FeatureImageType::PixelType FeatureScalarType
Define numeric traits for std::vector.
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::ScalarValueType ScalarValueType
This function is used in ThresholdSegmentationLevelSetImageFilter to segment structures in images bas...