ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkCurvesLevelSetFunction.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 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:
63  public SegmentationLevelSetFunction< TImageType, TFeatureImageType >
64 {
65 public:
66  ITK_DISALLOW_COPY_AND_ASSIGN(CurvesLevelSetFunction);
67 
74  using FeatureImageType = TFeatureImageType;
75 
77  itkNewMacro(Self);
78 
81 
84  using ImageType = typename Superclass::ImageType;
85  using NeighborhoodType = typename Superclass::NeighborhoodType;
86  using ScalarValueType = typename Superclass::ScalarValueType;
87  using FeatureScalarType = typename Superclass::FeatureScalarType;
88  using RadiusType = typename Superclass::RadiusType;
91  using VectorImageType = typename Superclass::VectorImageType;
92 
94  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
95 
97  void CalculateSpeedImage() override;
98 
100  void CalculateAdvectionImage() override;
101 
104  const FloatOffsetType & offset, GlobalDataStruct *gd) const override
105  { return this->PropagationSpeed(neighborhood, offset, gd); }
106 
109  void SetDerivativeSigma(const double v)
110  { m_DerivativeSigma = v; }
112  { return m_DerivativeSigma; }
114 
115  void Initialize(const RadiusType & r) override;
116 
117 protected:
119 
120  {
121  //Curvature term is the minimal curvature.
122  this->UseMinimalCurvatureOn();
123  this->SetAdvectionWeight(NumericTraits< ScalarValueType >::OneValue());
124  this->SetPropagationWeight(NumericTraits< ScalarValueType >::OneValue());
125  this->SetCurvatureWeight(NumericTraits< ScalarValueType >::OneValue());
126  }
127 
128  ~CurvesLevelSetFunction() override = default;
129 
130  void PrintSelf(std::ostream & os, Indent indent) const override
131  {
132  Superclass::PrintSelf(os, indent);
133  os << indent << "DerivativeSigma: " << m_DerivativeSigma << std::endl;
134  }
135 
136 private:
137 
139  std::slice x_slice[ImageDimension];
140 
142  OffsetValueType m_Center{0};
143 
145  OffsetValueType m_xStride[ImageDimension];
146 
147  double m_DerivativeSigma{1.0};
148 };
149 } // end namespace itk
150 
151 #ifndef ITK_MANUAL_INSTANTIATION
152 #include "itkCurvesLevelSetFunction.hxx"
153 #endif
154 
155 #endif
ScalarValueType CurvatureSpeed(const NeighborhoodType &neighborhood, const FloatOffsetType &offset, GlobalDataStruct *gd) 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...
void PrintSelf(std::ostream &os, Indent indent) const override
Define numeric traits for std::vector.
typename Superclass::VectorImageType VectorImageType
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
typename ImageType::PixelType PixelType
typename SuperSuperclass::GlobalDataStruct GlobalDataStruct
typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
typename Superclass::FeatureScalarType FeatureScalarType
typename Superclass::PixelType PixelType
typename Superclass::FloatOffsetType FloatOffsetType
typename Superclass::ScalarValueType ScalarValueType
This function is used in CurvesLevelSetImageFilter to segment structures in images based on user supp...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
signed long OffsetValueType
Definition: itkIntTypes.h:94