ITK  5.4.0
Insight Toolkit
itkCurvesLevelSetFunction.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 itkCurvesLevelSetFunction_h
19 #define itkCurvesLevelSetFunction_h
20 
22 
23 namespace itk
24 {
61 template <typename TImageType, typename TFeatureImageType = TImageType>
62 class ITK_TEMPLATE_EXPORT CurvesLevelSetFunction : public SegmentationLevelSetFunction<TImageType, TFeatureImageType>
63 {
64 public:
65  ITK_DISALLOW_COPY_AND_MOVE(CurvesLevelSetFunction);
66 
73  using FeatureImageType = TFeatureImageType;
74 
76  itkNewMacro(Self);
77 
79  itkOverrideGetNameOfClassMacro(CurvesLevelSetFunction);
80 
83  using typename Superclass::ImageType;
84  using typename Superclass::NeighborhoodType;
85  using typename Superclass::ScalarValueType;
86  using typename Superclass::FeatureScalarType;
87  using typename Superclass::RadiusType;
90  using typename Superclass::VectorImageType;
91 
93  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
94 
96  void
97  CalculateSpeedImage() override;
98 
100  void
101  CalculateAdvectionImage() override;
102 
105  CurvatureSpeed(const NeighborhoodType & neighborhood,
106  const FloatOffsetType & offset,
107  GlobalDataStruct * gd) const override
108  {
109  return this->PropagationSpeed(neighborhood, offset, gd);
110  }
111 
114  void
115  SetDerivativeSigma(const double v)
116  {
117  m_DerivativeSigma = v;
118  }
119  double
121  {
122  return m_DerivativeSigma;
123  }
126  void
127  Initialize(const RadiusType & r) override;
128 
129 protected:
131 
132  {
133  // Curvature term is the minimal curvature.
134  this->UseMinimalCurvatureOn();
135  this->SetAdvectionWeight(NumericTraits<ScalarValueType>::OneValue());
136  this->SetPropagationWeight(NumericTraits<ScalarValueType>::OneValue());
137  this->SetCurvatureWeight(NumericTraits<ScalarValueType>::OneValue());
138  }
139 
140  ~CurvesLevelSetFunction() override = default;
141 
142  void
143  PrintSelf(std::ostream & os, Indent indent) const override
144  {
145  Superclass::PrintSelf(os, indent);
146  os << indent << "DerivativeSigma: " << m_DerivativeSigma << std::endl;
147  }
148 
149 private:
151  std::slice x_slice[ImageDimension];
152 
154  OffsetValueType m_Center{ 0 };
155 
157  OffsetValueType m_xStride[ImageDimension]{};
158 
159  double m_DerivativeSigma{ 1.0 };
160 };
161 } // end namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 # include "itkCurvesLevelSetFunction.hxx"
165 #endif
166 
167 #endif
itk::CurvesLevelSetFunction::SetDerivativeSigma
void SetDerivativeSigma(const double v)
Definition: itkCurvesLevelSetFunction.h:115
itk::CurvesLevelSetFunction::CurvesLevelSetFunction
CurvesLevelSetFunction()
Definition: itkCurvesLevelSetFunction.h:130
itk::CurvesLevelSetFunction::FeatureImageType
TFeatureImageType FeatureImageType
Definition: itkCurvesLevelSetFunction.h:73
itk::LevelSetFunction::GlobalDataStruct
Definition: itkLevelSetFunction.h:106
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::CurvesLevelSetFunction::CurvatureSpeed
ScalarValueType CurvatureSpeed(const NeighborhoodType &neighborhood, const FloatOffsetType &offset, GlobalDataStruct *gd) const override
Definition: itkCurvesLevelSetFunction.h:105
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkSegmentationLevelSetFunction.h
itk::FiniteDifferenceFunction::PixelType
typename ImageType::PixelType PixelType
Definition: itkFiniteDifferenceFunction.h:83
itk::OffsetValueType
long OffsetValueType
Definition: itkIntTypes.h:94
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:59
itk::LevelSetFunction::ScalarValueType
PixelType ScalarValueType
Definition: itkLevelSetFunction.h:90
itk::CurvesLevelSetFunction::GlobalDataStruct
typename SuperSuperclass::GlobalDataStruct GlobalDataStruct
Definition: itkCurvesLevelSetFunction.h:89
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::CurvesLevelSetFunction::GetDerivativeSigma
double GetDerivativeSigma()
Definition: itkCurvesLevelSetFunction.h:120
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::CurvesLevelSetFunction::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
Definition: itkCurvesLevelSetFunction.h:143
itk::CurvesLevelSetFunction
This function is used in CurvesLevelSetImageFilter to segment structures in images based on user supp...
Definition: itkCurvesLevelSetFunction.h:62