ITK  6.0.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  * https://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 
59  itkOverrideGetNameOfClassMacro(SegmentationLevelSetFunction);
60 
62  using typename Superclass::ImageType;
63  using typename Superclass::RadiusType;
64  using typename Superclass::PixelRealType;
65  using FeatureImageType = TFeatureImageType;
66  using typename Superclass::FloatOffsetType;
67  using typename Superclass::ScalarValueType;
68  using typename Superclass::NeighborhoodType;
69  using FeatureScalarType = typename FeatureImageType::PixelType;
70  using IndexType = typename ImageType::IndexType;
71  using typename Superclass::VectorType;
72  using 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  }
103  virtual ImageType *
105  {
106  return m_SpeedImage.GetPointer();
107  }
108  void
109  SetSpeedImage(ImageType * s);
113  virtual VectorImageType *
115  {
116  return m_AdvectionImage.GetPointer();
117  }
118  void
119  SetAdvectionImage(VectorImageType * s);
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 
175  typename VectorImageType::Pointer m_AdvectionImage{};
176 
178  ScalarValueType
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 
194  typename InterpolatorType::Pointer m_Interpolator{};
195 
196  typename VectorInterpolatorType::Pointer m_VectorInterpolator{};
197 };
198 } // namespace itk
199 
200 #ifndef ITK_MANUAL_INSTANTIATION
201 # include "itkSegmentationLevelSetFunction.hxx"
202 #endif
203 
204 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itkLevelSetFunction.h
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
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::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::SmartPointer< Self >
itkVectorLinearInterpolateImageFunction.h
itkCastImageFilter.h
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:51
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::SegmentationLevelSetFunction::FeatureScalarType
typename FeatureImageType::PixelType FeatureScalarType
Definition: itkSegmentationLevelSetFunction.h:69
itk::SegmentationLevelSetFunction::CalculateAdvectionImage
virtual void CalculateAdvectionImage()
Definition: itkSegmentationLevelSetFunction.h:141
itk::SegmentationLevelSetFunction::SetFeatureImage
virtual void SetFeatureImage(const FeatureImageType *f)
Definition: itkSegmentationLevelSetFunction.h:96
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ContinuousIndex< TCoordinate, Self::ImageDimension >
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:88
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
New
static Pointer New()
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