ITK  4.13.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:
66  typedef TFeatureImageType FeatureImageType;
67 
69  itkNewMacro(Self);
70 
73 
75  typedef typename Superclass::ImageType ImageType;
78  typedef typename Superclass::RadiusType RadiusType;
79 
81  itkStaticConstMacro(ImageDimension, unsigned int,
82  Superclass::ImageDimension);
83 
86  { m_UpperThreshold = f; }
88  { return m_UpperThreshold; }
90  { m_LowerThreshold = f; }
92  { return m_LowerThreshold; }
94 
95  virtual void CalculateSpeedImage() ITK_OVERRIDE;
96 
97  virtual void Initialize(const RadiusType & r) ITK_OVERRIDE
98  {
99  Superclass::Initialize(r);
100 
101  this->SetAdvectionWeight(NumericTraits< ScalarValueType >::ZeroValue());
102  this->SetPropagationWeight(-1.0 * NumericTraits< ScalarValueType >::OneValue());
103  this->SetCurvatureWeight(NumericTraits< ScalarValueType >::OneValue());
104  }
105 
109  {
110  m_EdgeWeight = p;
111  }
112 
114  {
115  return m_EdgeWeight;
116  }
117 
122  {
123  m_SmoothingConductance = p;
124  }
125 
127  {
128  return m_SmoothingConductance;
129  }
130 
134  void SetSmoothingIterations(const int p)
135  {
136  m_SmoothingIterations = p;
137  }
138 
140  {
141  return m_SmoothingIterations;
142  }
143 
148  {
149  m_SmoothingTimeStep = i;
150  }
151 
153  {
154  return m_SmoothingTimeStep;
155  }
156 
157 protected:
159  {
160  m_UpperThreshold = NumericTraits< FeatureScalarType >::max();
162  this->SetAdvectionWeight(0.0);
163  this->SetPropagationWeight(1.0);
164  this->SetCurvatureWeight(1.0);
165  this->SetSmoothingIterations(5);
166  this->SetSmoothingConductance(0.8);
167  this->SetSmoothingTimeStep(0.1);
168  this->SetEdgeWeight(0.0);
169  }
170 
171  virtual ~ThresholdSegmentationLevelSetFunction() ITK_OVERRIDE {}
172 
173  ITK_DISALLOW_COPY_AND_ASSIGN(ThresholdSegmentationLevelSetFunction);
174 
175  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE
176  {
177  Superclass::PrintSelf(os, indent);
178  os << indent << "UpperThreshold: " << m_UpperThreshold << std::endl;
179  os << indent << "LowerThreshold: " << m_LowerThreshold << std::endl;
180  os << indent << "EdgeWeight: " << m_EdgeWeight << std::endl;
181  os << indent << "SmoothingTimeStep: " << m_SmoothingTimeStep << std::endl;
182  os << indent << "SmoothingIterations: " << m_SmoothingIterations << std::endl;
183  os << indent << "SmoothingConductance: " << m_SmoothingConductance << std::endl;
184  }
185 
192 };
193 } // end namespace itk
194 
195 #ifndef ITK_MANUAL_INSTANTIATION
196 #include "itkThresholdSegmentationLevelSetFunction.hxx"
197 #endif
198 
199 #endif
Light weight base class for most itk classes.
ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
SegmentationLevelSetFunction< TImageType, TFeatureImageType > Superclass
static ITK_CONSTEXPR_FUNC T max(const T &)
static ITK_CONSTEXPR_FUNC T NonpositiveMin()
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.
This function is used in ThresholdSegmentationLevelSetImageFilter to segment structures in images bas...