ITK  4.2.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< class TImageType, class TFeatureImageType = TImageType >
57  public SegmentationLevelSetFunction< TImageType, TFeatureImageType >
58 {
59 public:
66  typedef TFeatureImageType FeatureImageType;
67 
69  itkNewMacro(Self);
70 
73 
75  typedef typename Superclass::ImageType ImageType;
76  typedef typename Superclass::ScalarValueType ScalarValueType;
77  typedef typename Superclass::FeatureScalarType FeatureScalarType;
78  typedef typename Superclass::RadiusType RadiusType;
79 
81  itkStaticConstMacro(ImageDimension, unsigned int,
82  Superclass::ImageDimension);
83 
85  void SetUpperThreshold(FeatureScalarType f)
86  { m_UpperThreshold = f; }
87  FeatureScalarType GetUpperThreshold() const
88  { return m_UpperThreshold; }
89  void SetLowerThreshold(FeatureScalarType f)
90  { m_LowerThreshold = f; }
91  FeatureScalarType GetLowerThreshold() const
92  { return m_LowerThreshold; }
94 
95  virtual void CalculateSpeedImage();
96 
97  virtual void Initialize(const RadiusType & r)
98  {
99  Superclass::Initialize(r);
100 
101  this->SetAdvectionWeight(NumericTraits< ScalarValueType >::Zero);
102  this->SetPropagationWeight(-1.0 * NumericTraits< ScalarValueType >::One);
103  this->SetCurvatureWeight(NumericTraits< ScalarValueType >::One);
104  }
105 
108  void SetEdgeWeight(const ScalarValueType p)
109  {
110  m_EdgeWeight = p;
111  }
112 
113  ScalarValueType GetEdgeWeight() const
114  {
115  return m_EdgeWeight;
116  }
117 
121  void SetSmoothingConductance(const ScalarValueType p)
122  {
123  m_SmoothingConductance = p;
124  }
125 
126  ScalarValueType GetSmoothingConductance() const
127  {
128  return m_SmoothingConductance;
129  }
130 
134  void SetSmoothingIterations(const int p)
135  {
136  m_SmoothingIterations = p;
137  }
138 
139  int GetSmoothingIterations() const
140  {
141  return m_SmoothingIterations;
142  }
143 
147  void SetSmoothingTimeStep(const ScalarValueType i)
148  {
149  m_SmoothingTimeStep = i;
150  }
151 
152  ScalarValueType GetSmoothingTimeStep() const
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 
172 
173  ThresholdSegmentationLevelSetFunction(const Self &); //purposely not
174  // implemented
175  void operator=(const Self &); //purposely not
176  // implemented
177 
178  void PrintSelf(std::ostream & os, Indent indent) const
179  {
180  Superclass::PrintSelf(os, indent);
181  os << indent << "UpperThreshold: " << m_UpperThreshold << std::endl;
182  os << indent << "LowerThreshold: " << m_LowerThreshold << std::endl;
183  os << indent << "EdgeWeight: " << m_EdgeWeight << std::endl;
184  os << indent << "SmoothingTimeStep: " << m_SmoothingTimeStep << std::endl;
185  os << indent << "SmoothingIterations: " << m_SmoothingIterations << std::endl;
186  os << indent << "SmoothingConductance: " << m_SmoothingConductance << std::endl;
187  }
188 
195 };
196 } // end namespace itk
197 
198 #ifndef ITK_MANUAL_INSTANTIATION
199 #include "itkThresholdSegmentationLevelSetFunction.hxx"
200 #endif
201 
202 #endif
203