ITK  5.2.0
Insight Toolkit
itkSegmentationLevelSetFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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"
24 #include "itkCastImageFilter.h"
25 
26 namespace itk
27 {
46 template <typename TImageType, typename TFeatureImageType = TImageType>
47 class ITK_TEMPLATE_EXPORT SegmentationLevelSetFunction : public LevelSetFunction<TImageType>
48 {
49 public:
50  ITK_DISALLOW_COPY_AND_MOVE(SegmentationLevelSetFunction);
51 
57 
60 
62  using ImageType = typename Superclass::ImageType;
63  using RadiusType = typename Superclass::RadiusType;
64  using PixelRealType = typename Superclass::PixelRealType;
65  using FeatureImageType = TFeatureImageType;
66  using FloatOffsetType = typename Superclass::FloatOffsetType;
67  using ScalarValueType = typename Superclass::ScalarValueType;
68  using NeighborhoodType = typename Superclass::NeighborhoodType;
69  using FeatureScalarType = typename FeatureImageType::PixelType;
70  using IndexType = typename ImageType::IndexType;
72  using GlobalDataStruct = typename Superclass::GlobalDataStruct;
73 
75  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
76 
79 
82 
85 
88 
90  virtual const FeatureImageType *
92  {
93  return m_FeatureImage.GetPointer();
94  }
95  virtual void
97  {
98  m_FeatureImage = f;
99  }
101 
103  virtual ImageType *
105  {
106  return m_SpeedImage.GetPointer();
107  }
108  void
109  SetSpeedImage(ImageType * s);
111 
113  virtual VectorImageType *
115  {
116  return m_AdvectionImage.GetPointer();
117  }
118  void
119  SetAdvectionImage(VectorImageType * s);
121 
125  void
126  Initialize(const RadiusType & r) override;
127 
132  virtual void
134  {}
135 
140  virtual void
142  {}
143 
146  virtual void
147  AllocateSpeedImage();
148 
151  virtual void
152  AllocateAdvectionImage();
153 
164  virtual void
165  ReverseExpansionDirection();
166 
167 protected:
169  typename FeatureImageType::ConstPointer m_FeatureImage;
170 
172  typename ImageType::Pointer m_SpeedImage;
173 
176 
179  PropagationSpeed(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct * gd) const override;
180 
182  VectorType
183  AdvectionField(const NeighborhoodType &, const FloatOffsetType &, GlobalDataStruct * gd) const override;
184 
185  ~SegmentationLevelSetFunction() override = default;
187  {
188  m_SpeedImage = ImageType::New();
189  m_AdvectionImage = VectorImageType::New();
190  m_Interpolator = InterpolatorType::New();
191  m_VectorInterpolator = VectorInterpolatorType::New();
192  }
193 
195 
197 };
198 } // namespace itk
199 
200 #ifndef ITK_MANUAL_INSTANTIATION
201 # include "itkSegmentationLevelSetFunction.hxx"
202 #endif
203 
204 #endif
itkLevelSetFunction.h
itk::FiniteDifferenceFunction::RadiusType
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
Definition: itkFiniteDifferenceFunction.h:97
itk::SegmentationLevelSetFunction::GetAdvectionImage
virtual VectorImageType * GetAdvectionImage() const
Definition: itkSegmentationLevelSetFunction.h:114
itkLinearInterpolateImageFunction.h
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::FiniteDifferenceFunction::PixelRealType
double PixelRealType
Definition: itkFiniteDifferenceFunction.h:84
itk::SegmentationLevelSetFunction::GetSpeedImage
virtual ImageType * GetSpeedImage()
Definition: itkSegmentationLevelSetFunction.h:104
itk::SegmentationLevelSetFunction::SegmentationLevelSetFunction
SegmentationLevelSetFunction()
Definition: itkSegmentationLevelSetFunction.h:186
itk::SegmentationLevelSetFunction::GetFeatureImage
virtual const FeatureImageType * GetFeatureImage() const
Definition: itkSegmentationLevelSetFunction.h:91
itk::SegmentationLevelSetFunction::GlobalDataStruct
typename Superclass::GlobalDataStruct GlobalDataStruct
Definition: itkSegmentationLevelSetFunction.h:72
itk::SmartPointer< Self >
itkVectorLinearInterpolateImageFunction.h
itkCastImageFilter.h
itk::FiniteDifferenceFunction::ImageType
TImageType ImageType
Definition: itkFiniteDifferenceFunction.h:82
itk::SegmentationLevelSetFunction::FeatureImageType
TFeatureImageType FeatureImageType
Definition: itkSegmentationLevelSetFunction.h:65
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LinearInterpolateImageFunction
Linearly interpolate an image at specified positions.
Definition: itkLinearInterpolateImageFunction.h:50
itk::LinearInterpolateImageFunction::ContinuousIndexType
typename Superclass::ContinuousIndexType ContinuousIndexType
Definition: itkLinearInterpolateImageFunction.h:89
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::SegmentationLevelSetFunction::m_VectorInterpolator
VectorInterpolatorType::Pointer m_VectorInterpolator
Definition: itkSegmentationLevelSetFunction.h:196
itk::SegmentationLevelSetFunction::FeatureScalarType
typename FeatureImageType::PixelType FeatureScalarType
Definition: itkSegmentationLevelSetFunction.h:69
itk::SegmentationLevelSetFunction::CalculateAdvectionImage
virtual void CalculateAdvectionImage()
Definition: itkSegmentationLevelSetFunction.h:141
itk::FixedArray
Simulate a standard C array with copy semantics.
Definition: itkFixedArray.h:52
itk::SegmentationLevelSetFunction::m_Interpolator
InterpolatorType::Pointer m_Interpolator
Definition: itkSegmentationLevelSetFunction.h:194
itk::SegmentationLevelSetFunction::SetFeatureImage
virtual void SetFeatureImage(const FeatureImageType *f)
Definition: itkSegmentationLevelSetFunction.h:96
itk::LevelSetFunction::ScalarValueType
PixelType ScalarValueType
Definition: itkLevelSetFunction.h:90
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:51
itk::SegmentationLevelSetFunction
Definition: itkSegmentationLevelSetFunction.h:47
itk::SegmentationLevelSetFunction::IndexType
typename ImageType::IndexType IndexType
Definition: itkSegmentationLevelSetFunction.h:70
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::LevelSetFunction
The LevelSetFunction class is a generic function object which can be used to create a level set metho...
Definition: itkLevelSetFunction.h:66
itk::SegmentationLevelSetFunction::CalculateSpeedImage
virtual void CalculateSpeedImage()
Definition: itkSegmentationLevelSetFunction.h:133
itk::SegmentationLevelSetFunction::m_FeatureImage
FeatureImageType::ConstPointer m_FeatureImage
Definition: itkSegmentationLevelSetFunction.h:169
itk::SegmentationLevelSetFunction::m_AdvectionImage
VectorImageType::Pointer m_AdvectionImage
Definition: itkSegmentationLevelSetFunction.h:175
itk::SegmentationLevelSetFunction::m_SpeedImage
ImageType::Pointer m_SpeedImage
Definition: itkSegmentationLevelSetFunction.h:172
itk::SegmentationLevelSetFunction::ContinuousIndexType
typename InterpolatorType::ContinuousIndexType ContinuousIndexType
Definition: itkSegmentationLevelSetFunction.h:87
itk::VectorLinearInterpolateImageFunction
Linearly interpolate a vector image at specified positions.
Definition: itkVectorLinearInterpolateImageFunction.h:43