ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkFastMarchingUpwindGradientImageFilter.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 __itkFastMarchingUpwindGradientImageFilter_h
19 #define __itkFastMarchingUpwindGradientImageFilter_h
20 
22 #include "itkImage.h"
23 
24 namespace itk
25 {
58 template<
59  class TLevelSet,
60  class TSpeedImage = Image< float, TLevelSet ::ImageDimension > >
62  public FastMarchingImageFilter< TLevelSet, TSpeedImage >
63 {
64 public:
70 
72  itkNewMacro(Self);
73 
76 
78  typedef typename Superclass::LevelSetType LevelSetType;
79  typedef typename Superclass::SpeedImageType SpeedImageType;
80  typedef typename Superclass::LevelSetImageType LevelSetImageType;
81  typedef typename Superclass::LevelSetPointer LevelSetPointer;
82  typedef typename Superclass::SpeedImageConstPointer SpeedImageConstPointer;
83  typedef typename Superclass::LabelImageType LabelImageType;
84  typedef typename Superclass::PixelType PixelType;
85  typedef typename Superclass::AxisNodeType AxisNodeType;
86  typedef typename Superclass::NodeType NodeType;
87  typedef typename Superclass::NodeContainer NodeContainer;
89 
90  typedef typename Superclass::IndexType IndexType;
91  typedef typename Superclass::OutputSpacingType OutputSpacingType;
92  typedef typename Superclass::LevelSetIndexType LevelSetIndexType;
93 
94  typedef typename Superclass::OutputPointType PointType;
95 
97  itkStaticConstMacro(SetDimension, unsigned int, Superclass::SetDimension);
98 
102  void SetTargetPoints(NodeContainer *points)
103  {
104  m_TargetPoints = points;
105  this->Modified();
106  }
108 
110  NodeContainerPointer GetTargetPoints()
111  { return m_TargetPoints; }
112 
114  NodeContainerPointer GetReachedTargetPoints()
115  { return m_ReachedTargetPoints; }
116 
118  typedef CovariantVector< PixelType,
119  itkGetStaticConstMacro(SetDimension) > GradientPixelType;
120 
122  typedef Image< GradientPixelType,
123  itkGetStaticConstMacro(SetDimension) > GradientImageType;
124 
127 
129  GradientImagePointer GetGradientImage() const
130  { return m_GradientImage; }
131 
134  itkSetMacro(GenerateGradientImage, bool);
135 
137  itkGetConstReferenceMacro(GenerateGradientImage, bool);
138  itkBooleanMacro(GenerateGradientImage);
140 
144  itkSetMacro(TargetOffset, double);
145 
147  itkGetConstReferenceMacro(TargetOffset, double);
148 
152  itkSetMacro(TargetReachedMode, int);
153  itkGetConstReferenceMacro(TargetReachedMode, int);
154  void SetTargetReachedModeToNoTargets()
155  { this->SetTargetReachedMode(NoTargets); }
156  void SetTargetReachedModeToOneTarget()
157  { this->SetTargetReachedMode(OneTarget); }
158  void SetTargetReachedModeToSomeTargets(SizeValueType numberOfTargets)
159  {
160  this->SetTargetReachedMode(SomeTargets);
161  m_NumberOfTargets = numberOfTargets;
162  }
164 
165  void SetTargetReachedModeToAllTargets()
166  { this->SetTargetReachedMode(AllTargets); }
167 
169  itkGetConstReferenceMacro(NumberOfTargets, SizeValueType);
170 
175  itkGetConstReferenceMacro(TargetValue, double);
176 
177  enum {
181  AllTargets
182  };
183 
184 #ifdef ITK_USE_CONCEPT_CHECKING
185 
186  itkConceptMacro( LevelSetDoubleDivisionOperatorsCheck,
188  itkConceptMacro( LevelSetDoubleDivisionAndAssignOperatorsCheck,
190 
192 #endif
193 
194 protected:
197  void PrintSelf(std::ostream & os, Indent indent) const;
198 
199  virtual void Initialize(LevelSetImageType *);
200 
201  void GenerateData();
202 
203  virtual void UpdateNeighbors(const IndexType & index,
204  const SpeedImageType *, LevelSetImageType *);
205 
206  virtual void ComputeGradient(const IndexType & index,
207  const LevelSetImageType *output,
208  const LabelImageType *labelImage,
209  GradientImageType *gradientImage);
210 
211 private:
212  FastMarchingUpwindGradientImageFilter(const Self &); //purposely not
213  // implemented
214  void operator=(const Self &); //purposely not
215  // implemented
216 
219 
221 
223 
225 
227 
229 
231 };
232 } // namespace itk
233 
234 #ifndef ITK_MANUAL_INSTANTIATION
235 #include "itkFastMarchingUpwindGradientImageFilter.hxx"
236 #endif
237 
238 #endif
239