Orfeo Toolbox  3.16
itkFastMarchingImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkFastMarchingImageFilter.h,v $
5  Language: C++
6  Date: $Date: 2010-01-13 14:19:09 $
7  Version: $Revision: 1.41 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkFastMarchingImageFilter_h
18 #define __itkFastMarchingImageFilter_h
19 
20 #include "itkImageToImageFilter.h"
21 #include "itkLevelSet.h"
22 #include "itkIndex.h"
23 #include "vnl/vnl_math.h"
24 
25 #include <functional>
26 #include <queue>
27 
28 namespace itk
29 {
30 
101 template <
102  class TLevelSet,
103  class TSpeedImage = Image<float,::itk::GetImageDimension<TLevelSet>::ImageDimension> >
105  public ImageToImageFilter<TSpeedImage,TLevelSet>
106 {
107 public:
113 
115  itkNewMacro(Self);
116 
119 
128  typedef typename LevelSetImageType::SizeType OutputSizeType;
129  typedef typename LevelSetImageType::RegionType OutputRegionType;
130  typedef typename LevelSetImageType::SpacingType OutputSpacingType;
131  typedef typename LevelSetImageType::DirectionType OutputDirectionType;
132  typedef typename LevelSetImageType::PointType OutputPointType;
133 
134  class AxisNodeType : public NodeType
135  {
136  public:
137  int GetAxis() const { return m_Axis; }
138  void SetAxis( int axis ) { m_Axis = axis; }
139  const AxisNodeType & operator=(const NodeType & node)
140  { this->NodeType::operator=(node); return *this; }
141  private:
142  int m_Axis;
143  };
144 
146  typedef TSpeedImage SpeedImageType;
147 
149  typedef typename SpeedImageType::Pointer SpeedImagePointer;
150  typedef typename SpeedImageType::ConstPointer SpeedImageConstPointer;
151 
153  itkStaticConstMacro(SetDimension, unsigned int,
154  LevelSetType::SetDimension);
155  itkStaticConstMacro(SpeedImageDimension, unsigned int,
156  SpeedImageType::ImageDimension);
157 
160 
165  enum LabelType { FarPoint, AlivePoint, TrialPoint, InitialTrialPoint };
166 
169 
172 
175  void SetAlivePoints( NodeContainer * points )
176  {
177  m_AlivePoints = points;
178  this->Modified();
179  }
180 
182  NodeContainerPointer GetAlivePoints( )
183  {
184  return m_AlivePoints;
185  }
186 
189  void SetTrialPoints( NodeContainer * points )
190  {
191  m_TrialPoints = points;
192  this->Modified();
193  }
194 
196  NodeContainerPointer GetTrialPoints( )
197  {
198  return m_TrialPoints;
199  }
200 
202  LabelImagePointer GetLabelImage() const
203  {
204  return m_LabelImage;
205  }
206 
210  void SetSpeedConstant( double value )
211  {
212  m_SpeedConstant = value;
213  m_InverseSpeed = -1.0 * vnl_math_sqr( 1.0 / m_SpeedConstant );
214  this->Modified();
215  }
216 
218  itkGetConstReferenceMacro( SpeedConstant, double );
219 
224  itkSetMacro( NormalizationFactor, double );
225  itkGetConstMacro( NormalizationFactor, double );
226 
230  itkSetMacro( StoppingValue, double );
231 
233  itkGetConstReferenceMacro( StoppingValue, double );
234 
239  itkSetMacro( CollectPoints, bool );
240 
242  itkGetConstReferenceMacro( CollectPoints, bool );
243  itkBooleanMacro( CollectPoints );
244 
249  NodeContainerPointer GetProcessedPoints() const
250  {
251  return m_ProcessedPoints;
252  }
253 
260  virtual void SetOutputSize( const OutputSizeType& size )
261  { m_OutputRegion = size; }
262  virtual OutputSizeType GetOutputSize() const
263  { return m_OutputRegion.GetSize(); }
264  itkSetMacro( OutputRegion, OutputRegionType );
265  itkGetConstReferenceMacro( OutputRegion, OutputRegionType );
266  itkSetMacro( OutputSpacing, OutputSpacingType );
267  itkGetConstReferenceMacro( OutputSpacing, OutputSpacingType );
268  itkSetMacro( OutputDirection, OutputDirectionType );
269  itkGetConstReferenceMacro( OutputDirection, OutputDirectionType );
270  itkSetMacro( OutputOrigin, OutputPointType );
271  itkGetConstReferenceMacro( OutputOrigin, OutputPointType );
272  itkSetMacro( OverrideOutputInformation, bool );
273  itkGetConstReferenceMacro( OverrideOutputInformation, bool );
274  itkBooleanMacro( OverrideOutputInformation );
275 
276 #ifdef ITK_USE_CONCEPT_CHECKING
277 
278  itkConceptMacro(SameDimensionCheck,
280  itkConceptMacro(SpeedConvertibleToDoubleCheck,
282  itkConceptMacro(DoubleConvertibleToLevelSetCheck,
284  itkConceptMacro(LevelSetOStreamWritableCheck,
287 #endif
288 
289 protected:
292  void PrintSelf( std::ostream& os, Indent indent ) const;
293 
294  virtual void Initialize( LevelSetImageType * );
295  virtual void UpdateNeighbors( const IndexType& index,
296  const SpeedImageType *, LevelSetImageType * );
297  virtual double UpdateValue( const IndexType& index,
298  const SpeedImageType *, LevelSetImageType * );
299 
300 
301  const AxisNodeType& GetNodeUsedInCalculation(unsigned int idx) const
302  { return m_NodesUsed[idx]; }
303 
304  void GenerateData();
305 
307  virtual void GenerateOutputInformation();
308  virtual void EnlargeOutputRequestedRegion(DataObject *output);
309 
314  itkGetConstReferenceMacro( LargeValue, PixelType );
315 
317  typedef typename LevelSetImageType::IndexType LevelSetIndexType;
320 
321  itkGetConstReferenceMacro( StartIndex, LevelSetIndexType );
322  itkGetConstReferenceMacro( LastIndex, LevelSetIndexType );
323 
324 private:
325  FastMarchingImageFilter(const Self&); //purposely not implemented
326  void operator=(const Self&); //purposely not implemented
327 
330 
332 
336 
339 
345 
346 
347  typename LevelSetImageType::PixelType m_LargeValue;
348  AxisNodeType m_NodesUsed[SetDimension];
349 
353  typedef std::vector<AxisNodeType> HeapContainer;
354  typedef std::greater<AxisNodeType> NodeComparer;
355  typedef std::priority_queue< AxisNodeType, HeapContainer, NodeComparer >
357 
359 
361 };
362 
363 } // namespace itk
364 
365 
366 #ifndef ITK_MANUAL_INSTANTIATION
368 #endif
369 
370 #endif

Generated at Sat Feb 2 2013 23:36:32 for Orfeo Toolbox with doxygen 1.8.1.1