ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkCannySegmentationLevelSetFunction.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 itkCannySegmentationLevelSetFunction_h
19 #define itkCannySegmentationLevelSetFunction_h
20 
22 #include "itkCastImageFilter.h"
25 
26 namespace itk
27 {
34 template< typename TImageType, typename TFeatureImageType = TImageType >
36  public SegmentationLevelSetFunction< TImageType, TFeatureImageType >
37 {
38 public:
44  typedef TFeatureImageType FeatureImageType;
45 
47  itkNewMacro(Self);
48 
51 
53  typedef typename Superclass::ImageType ImageType;
58 
60  itkStaticConstMacro(ImageDimension, unsigned int,
62 
65  { m_Threshold = v; }
67  { return m_Threshold; }
69 
71  void SetVariance(double v)
72  { m_Variance = v; }
73  double GetVariance() const
74  { return m_Variance; }
76 
79  virtual void CalculateSpeedImage() ITK_OVERRIDE;
80 
83  virtual void CalculateAdvectionImage() ITK_OVERRIDE;
84 
87  virtual void CalculateDistanceImage();
88 
89  virtual void Initialize(const RadiusType & r) ITK_OVERRIDE
90  {
92 
96  }
97 
99  { return m_Canny->GetOutput(); }
100 
101 protected:
103  {
104  m_Variance = 0.0;
109  }
110 
112 
113  CannySegmentationLevelSetFunction(const Self &) ITK_DELETE_FUNCTION;
114  void operator=(const Self &) ITK_DELETE_FUNCTION;
115 
116 private:
118  double m_Threshold;
119 
121 
122  typename DanielssonDistanceMapImageFilter< ImageType, ImageType >::Pointer m_Distance;
123 
125 
129  template <typename DummyImagePointerType>
130  void AssignCannyInput(typename FeatureImageType::Pointer &feature,
131  DummyImagePointerType &)
132  {
133  m_Caster->SetInput(feature);
134  m_Canny->SetInput( m_Caster->GetOutput() );
135  }
136 
140  void AssignCannyInput(typename FeatureImageType::Pointer &feature,
141  typename FeatureImageType::Pointer &)
142  {
143  m_Canny->SetInput(feature);
144  }
145 };
146 } // end namespace itk
148 
149 #ifndef ITK_MANUAL_INSTANTIATION
150 #include "itkCannySegmentationLevelSetFunction.hxx"
151 #endif
152 
153 #endif
virtual void Initialize(const RadiusType &r) override
Light weight base class for most itk classes.
void AssignCannyInput(typename FeatureImageType::Pointer &feature, DummyImagePointerType &)
static Pointer New()
ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType
CastImageFilter< FeatureImageType, ImageType >::Pointer m_Caster
virtual void SetInput(const InputImageType *image)
virtual void SetPropagationWeight(const ScalarValueType p)
virtual void CalculateAdvectionImage() override
void AssignCannyInput(typename FeatureImageType::Pointer &feature, typename FeatureImageType::Pointer &)
A refinement of the standard level-set function which computes a speed term and advection term based ...
OutputImageType * GetOutput()
virtual void CalculateSpeedImage() override
DanielssonDistanceMapImageFilter< ImageType, ImageType >::Pointer m_Distance
virtual void Initialize(const RadiusType &r) override
Define additional traits for native types such as int or float.
SegmentationLevelSetFunction< TImageType, TFeatureImageType > Superclass
virtual void SetCurvatureWeight(const ScalarValueType c)
virtual void SetAdvectionWeight(const ScalarValueType a)
This filter computes the distance map of the input image as an approximation with pixel accuracy to t...
Image< VectorType, itkGetStaticConstMacro(ImageDimension) > VectorImageType
Casts input pixels to output pixel type.
CannyEdgeDetectionImageFilter< ImageType, ImageType >::Pointer m_Canny
This filter is an implementation of a Canny edge detector for scalar-valued images.