ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkSegmentationLevelSetFunction.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 __itkSegmentationLevelSetFunction_h
19 #define __itkSegmentationLevelSetFunction_h
20 
21 #include "itkLevelSetFunction.h"
25 
26 namespace itk
27 {
46 template< class TImageType, class TFeatureImageType = TImageType >
48  public LevelSetFunction< TImageType >
49 {
50 public:
56 
59 
61  typedef typename Superclass::ImageType ImageType;
62  typedef typename Superclass::RadiusType RadiusType;
63  typedef typename Superclass::PixelRealType PixelRealType;
64  typedef TFeatureImageType FeatureImageType;
65  typedef typename Superclass::FloatOffsetType FloatOffsetType;
67  typedef typename Superclass::NeighborhoodType NeighborhoodType;
68  typedef typename FeatureImageType::PixelType FeatureScalarType;
69  typedef typename ImageType::IndexType IndexType;
70  typedef typename Superclass::VectorType VectorType;
71  typedef typename Superclass::GlobalDataStruct GlobalDataStruct;
72 
74  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
75 
78 
81 
84 
87 
89  virtual const FeatureImageType * GetFeatureImage() const
90  { return m_FeatureImage.GetPointer(); }
91  virtual void SetFeatureImage(const FeatureImageType *f)
92  { m_FeatureImage = f; }
94 
96  virtual ImageType * GetSpeedImage()
97  { return m_SpeedImage.GetPointer(); }
98  void SetSpeedImage(ImageType *s);
100 
102  virtual VectorImageType * GetAdvectionImage() const
103  { return m_AdvectionImage.GetPointer(); }
104  void SetAdvectionImage(VectorImageType *s);
106 
110  virtual void Initialize(const RadiusType & r);
111 
116  virtual void CalculateSpeedImage() {}
117 
122  virtual void CalculateAdvectionImage() {}
123 
126  virtual void AllocateSpeedImage();
127 
130  virtual void AllocateAdvectionImage();
131 
142  virtual void ReverseExpansionDirection();
143 
144 protected:
146  typename FeatureImageType::ConstPointer m_FeatureImage;
147 
149  typename ImageType::Pointer m_SpeedImage;
150 
153 
157 
159  virtual ScalarValueType PropagationSpeed(const NeighborhoodType &,
160  const FloatOffsetType &, GlobalDataStruct *gd) const;
161 
163  virtual VectorType AdvectionField(const NeighborhoodType &,
164  const FloatOffsetType &, GlobalDataStruct *gd) const;
165 
168  {
169  m_SpeedImage = ImageType::New();
170  m_AdvectionImage = VectorImageType::New();
171  m_Interpolator = InterpolatorType::New();
172  m_VectorInterpolator = VectorInterpolatorType::New();
173  }
174 
176 
178 
179 private:
180  SegmentationLevelSetFunction(const Self &); //purposely not implemented
181  void operator=(const Self &); //purposely not implemented
182 };
183 } // end namespace
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 #include "itkSegmentationLevelSetFunction.hxx"
187 #endif
188 
189 #endif
190