ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkLevelSetFunction.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 itkLevelSetFunction_h
19 #define itkLevelSetFunction_h
20 
22 #include "vnl/vnl_matrix_fixed.h"
23 
24 namespace itk
25 {
65 template< typename TImageType >
67  public FiniteDifferenceFunction< TImageType >
68 {
69 public:
75 
77  itkNewMacro(Self);
78 
81 
83  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
84 
86  typedef double TimeStepType;
87  typedef typename Superclass::ImageType ImageType;
88  typedef typename Superclass::PixelType PixelType;
95 
97  // typedef
99 
109 
111  vnl_matrix_fixed< ScalarValueType,
112  itkGetStaticConstMacro(ImageDimension),
113  itkGetStaticConstMacro(ImageDimension) > m_dxy;
114 
116  ScalarValueType m_dx[itkGetStaticConstMacro(ImageDimension)];
117 
118  ScalarValueType m_dx_forward[itkGetStaticConstMacro(ImageDimension)];
119  ScalarValueType m_dx_backward[itkGetStaticConstMacro(ImageDimension)];
120 
122  };
123 
126  const FloatOffsetType &, GlobalDataStruct * = 0) const
127  { return m_ZeroVectorConstant; }
128 
132  const NeighborhoodType &,
133  const FloatOffsetType &, GlobalDataStruct * = 0) const
135 
139  const FloatOffsetType &, GlobalDataStruct * = 0
140  ) const
142 
146  const NeighborhoodType &,
147  const FloatOffsetType &, GlobalDataStruct * = 0) const
149 
151  virtual void SetAdvectionWeight(const ScalarValueType a)
152  { m_AdvectionWeight = a; }
154  { return m_AdvectionWeight; }
156 
158  virtual void SetPropagationWeight(const ScalarValueType p)
159  { m_PropagationWeight = p; }
161  { return m_PropagationWeight; }
163 
165  virtual void SetCurvatureWeight(const ScalarValueType c)
166  { m_CurvatureWeight = c; }
168  { return m_CurvatureWeight; }
170 
175  { return m_LaplacianSmoothingWeight; }
177 
180  { m_EpsilonMagnitude = e; }
182  { return m_EpsilonMagnitude; }
184 
186  virtual PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
187  void *globalData,
188  const FloatOffsetType & = FloatOffsetType(0.0) ) ITK_OVERRIDE;
189 
196  virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const ITK_OVERRIDE;
197 
205  virtual void * GetGlobalDataPointer() const ITK_OVERRIDE
206  {
207  GlobalDataStruct *ans = new GlobalDataStruct();
208 
212  return ans;
213  }
214 
218  virtual void Initialize(const RadiusType & r);
219 
224  virtual void ReleaseGlobalDataPointer(void *GlobalData) const ITK_OVERRIDE
225  { delete (GlobalDataStruct *)GlobalData; }
226 
229  const FloatOffsetType &,
230  GlobalDataStruct *gd = 0
231  );
232 
234  const FloatOffsetType &,
235  GlobalDataStruct *gd = 0
236  );
237 
239  const FloatOffsetType &,
240  GlobalDataStruct *gd = 0
241  );
242 
244  const FloatOffsetType &,
245  GlobalDataStruct *gd = 0
246  );
247 
250  {
252  }
253 
255  {
256  return m_UseMinimalCurvature;
257  }
258 
260  {
261  this->SetUseMinimalCurvature(true);
262  }
263 
265  {
266  this->SetUseMinimalCurvature(false);
267  }
268 
273  static void SetMaximumCurvatureTimeStep(double n)
274  {
275  m_DT = n;
276  }
277 
279  {
280  return m_DT;
281  }
282 
287  static void SetMaximumPropagationTimeStep(double n)
288  {
289  m_WaveDT = n;
290  }
291 
293  {
294  return m_WaveDT;
295  }
296 
297 protected:
299  m_Center(0),
300  m_UseMinimalCurvature(false),
301  m_EpsilonMagnitude(static_cast< ScalarValueType >( 1.0e-5 )),
306  {
307  }
308 
309  virtual ~LevelSetFunction() {}
310  void PrintSelf(std::ostream & s, Indent indent) const ITK_OVERRIDE;
311 
313  static double m_WaveDT;
314  static double m_DT;
315 
317  std::slice x_slice[itkGetStaticConstMacro(ImageDimension)];
318 
321 
323  OffsetValueType m_xStride[itkGetStaticConstMacro(ImageDimension)];
324 
326 
330 
333 
336 
339 
342 
345 
348 
349 private:
350  LevelSetFunction(const Self &); //purposely not implemented
351  void operator=(const Self &); //purposely not implemented
352 };
353 } // namespace itk
354 
355 #ifndef ITK_MANUAL_INSTANTIATION
356 #include "itkLevelSetFunction.hxx"
357 #endif
358 
359 #endif
void operator=(const Self &)
static void SetMaximumCurvatureTimeStep(double n)
static VectorType m_ZeroVectorConstant
Superclass::RadiusType RadiusType
void PrintSelf(std::ostream &s, Indent indent) const override
Light weight base class for most itk classes.
The LevelSetFunction class is a generic function object which can be used to create a level set metho...
Superclass::NeighborhoodType NeighborhoodType
Superclass::PixelType PixelType
virtual ScalarValueType Compute3DMinimalCurvature(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd=0)
static const unsigned int ImageDimension
signed long OffsetValueType
Definition: itkIntTypes.h:154
static double GetMaximumCurvatureTimeStep()
virtual ScalarValueType ComputeMeanCurvature(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd=0)
Superclass::FloatOffsetType FloatOffsetType
Vector< PixelRealType, itkGetStaticConstMacro(ImageDimension) > NeighborhoodScalesType
ScalarValueType GetEpsilonMagnitude() const
ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
Superclass::ImageType ImageType
static const double e
The base of the natural logarithm or Euler&#39;s number
Definition: itkMath.h:45
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
virtual void Initialize(const RadiusType &r)
vnl_matrix_fixed< ScalarValueType, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension) > m_dxy
ScalarValueType m_AdvectionWeight
bool GetUseMinimalCurvature() const
virtual ScalarValueType PropagationSpeed(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const
virtual ScalarValueType LaplacianSmoothingSpeed(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const
Simulate a standard C array with copy semnatics.
Definition: itkFixedArray.h:50
ScalarValueType m_dx_backward[itkGetStaticConstMacro(ImageDimension)]
ScalarValueType m_PropagationWeight
Superclass::NeighborhoodScalesType NeighborhoodScalesType
SmartPointer< Self > Pointer
static VectorType InitializeZeroVectorConstant()
ScalarValueType m_dx_forward[itkGetStaticConstMacro(ImageDimension)]
static double GetMaximumPropagationTimeStep()
virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, void *globalData, const FloatOffsetType &=FloatOffsetType(0.0)) override
virtual void ReleaseGlobalDataPointer(void *GlobalData) const override
virtual ScalarValueType CurvatureSpeed(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
virtual void SetPropagationWeight(const ScalarValueType p)
ScalarValueType m_EpsilonMagnitude
ScalarValueType m_CurvatureWeight
virtual ScalarValueType ComputeCurvatureTerm(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd=0)
ScalarValueType m_dx[itkGetStaticConstMacro(ImageDimension)]
Superclass::PixelRealType PixelRealType
ScalarValueType GetLaplacianSmoothingWeight() const
OffsetValueType m_xStride[itkGetStaticConstMacro(ImageDimension)]
virtual void * GetGlobalDataPointer() const override
Vector< float, itkGetStaticConstMacro(ImageDimension) > FloatOffsetType
virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const override
virtual ScalarValueType ComputeMinimalCurvature(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *gd=0)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
std::slice x_slice[itkGetStaticConstMacro(ImageDimension)]
ScalarValueType GetAdvectionWeight() const
FixedArray< ScalarValueType, itkGetStaticConstMacro(ImageDimension) > VectorType
SmartPointer< const Self > ConstPointer
Define additional traits for native types such as int or float.
virtual void SetCurvatureWeight(const ScalarValueType c)
virtual void SetAdvectionWeight(const ScalarValueType a)
ScalarValueType GetCurvatureWeight() const
static void SetMaximumPropagationTimeStep(double n)
void SetLaplacianSmoothingWeight(const ScalarValueType c)
void SetUseMinimalCurvature(bool b)
void SetEpsilonMagnitude(const ScalarValueType e)
ScalarValueType GetPropagationWeight() const
static const unsigned int ImageDimension
virtual VectorType AdvectionField(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct *=0) const
FiniteDifferenceFunction< TImageType > Superclass
ScalarValueType m_LaplacianSmoothingWeight