ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkSegmentationLevelSetFunction.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 itkSegmentationLevelSetFunction_h
19 #define itkSegmentationLevelSetFunction_h
20 
21 #include "itkLevelSetFunction.h"
25 
26 namespace itk
27 {
46 template< typename TImageType, typename TFeatureImageType = TImageType >
47 class ITK_TEMPLATE_EXPORT SegmentationLevelSetFunction:
48  public LevelSetFunction< TImageType >
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_ASSIGN(SegmentationLevelSetFunction);
52 
58 
61 
63  using ImageType = typename Superclass::ImageType;
64  using RadiusType = typename Superclass::RadiusType;
65  using PixelRealType = typename Superclass::PixelRealType;
66  using FeatureImageType = TFeatureImageType;
67  using FloatOffsetType = typename Superclass::FloatOffsetType;
68  using ScalarValueType = typename Superclass::ScalarValueType;
69  using NeighborhoodType = typename Superclass::NeighborhoodType;
70  using FeatureScalarType = typename FeatureImageType::PixelType;
71  using IndexType = typename ImageType::IndexType;
73  using GlobalDataStruct = typename Superclass::GlobalDataStruct;
74 
76  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
77 
80 
83 
86 
89 
91  virtual const FeatureImageType * GetFeatureImage() const
92  { return m_FeatureImage.GetPointer(); }
93  virtual void SetFeatureImage(const FeatureImageType *f)
94  { m_FeatureImage = f; }
96 
99  { return m_SpeedImage.GetPointer(); }
100  void SetSpeedImage(ImageType *s);
102 
105  { return m_AdvectionImage.GetPointer(); }
106  void SetAdvectionImage(VectorImageType *s);
108 
112  void Initialize(const RadiusType & r) override;
113 
118  virtual void CalculateSpeedImage() {}
119 
124  virtual void CalculateAdvectionImage() {}
125 
128  virtual void AllocateSpeedImage();
129 
132  virtual void AllocateAdvectionImage();
133 
144  virtual void ReverseExpansionDirection();
145 
146 protected:
148  typename FeatureImageType::ConstPointer m_FeatureImage;
149 
151  typename ImageType::Pointer m_SpeedImage;
152 
155 
159 
161  ScalarValueType PropagationSpeed(const NeighborhoodType &,
162  const FloatOffsetType &, GlobalDataStruct *gd) const override;
163 
165  VectorType AdvectionField(const NeighborhoodType &,
166  const FloatOffsetType &, GlobalDataStruct *gd) const override;
167 
168  ~SegmentationLevelSetFunction() override = default;
170  {
171  m_SpeedImage = ImageType::New();
172  m_AdvectionImage = VectorImageType::New();
173  m_Interpolator = InterpolatorType::New();
174  m_VectorInterpolator = VectorInterpolatorType::New();
175  }
176 
178 
180 };
181 } // end namespace
182 
183 #ifndef ITK_MANUAL_INSTANTIATION
184 #include "itkSegmentationLevelSetFunction.hxx"
185 #endif
186 
187 #endif
typename Superclass::GlobalDataStruct GlobalDataStruct
Light weight base class for most itk classes.
Functor::VectorCast< typename VectorInterpolatorType::OutputType, VectorType > m_VectorCast
The LevelSetFunction class is a generic function object which can be used to create a level set metho...
typename FeatureImageType::PixelType FeatureScalarType
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Simulate a standard C array with copy semnatics.
Definition: itkFixedArray.h:51
VectorInterpolatorType::Pointer m_VectorInterpolator
typename InterpolatorType::ContinuousIndexType ContinuousIndexType
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
Linearly interpolate an image at specified positions.
virtual void SetFeatureImage(const FeatureImageType *f)
typename Superclass::ContinuousIndexType ContinuousIndexType
virtual const FeatureImageType * GetFeatureImage() const
virtual VectorImageType * GetAdvectionImage() const
Templated n-dimensional image class.
Definition: itkImage.h:75
Linearly interpolate a vector image at specified positions.