ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkArrivalFunctionToPathFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkArrivalFunctionToPathFilter.h,v $
5  Language: C++
6  Date: $Date$
7  Version: $Revision$
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 itkArrivalFunctionToPathFilter_h
18 #define itkArrivalFunctionToPathFilter_h
19 
20 #include "itkImage.h"
21 #include "itkCommand.h"
22 #include "itkImageToPathFilter.h"
27 
28 namespace itk
29 {
41 template <class TFilter>
43 {
44 public:
49 
51  itkNewMacro( Self );
52 
54  typedef TFilter FilterType;
55 
57  itkSetObjectMacro( Filter, FilterType );
58  itkGetConstObjectMacro( Filter, FilterType );
60 
62  void Execute(itk::Object *caller, const itk::EventObject & event)
63  {
64  Execute( (const itk::Object *)caller, event);
65  }
66 
68  void Execute(const itk::Object * object, const itk::EventObject & event)
69  {
70  if( ! itk::IterationEvent().CheckEvent( &event ) )
71  {
72  return;
73  }
74  // Pass event to Filter
75  if ( m_Filter.IsNotNull() )
76  {
77  m_Filter->Execute( object, event );
78  }
79  }
81 
82 protected:
85 
86 private:
88  void operator = ( const Self& );
89 
90  typename FilterType::Pointer m_Filter;
91 };
92 
93 
143 template <class TInputImage,
145 class ITK_EXPORT ArrivalFunctionToPathFilter :
146  public ImageToPathFilter<TInputImage,TOutputPath>
147 {
148 public:
154 
157 
159  itkNewMacro(Self);
160 
162  typedef TInputImage InputImageType;
163  typedef typename InputImageType::Pointer InputImagePointer;
164  typedef typename InputImageType::ConstPointer InputImageConstPointer;
165  typedef typename InputImageType::RegionType InputImageRegionType;
166  typedef typename InputImageType::PixelType InputImagePixelType;
167 
169  typedef TOutputPath OutputPathType;
170  typedef typename OutputPathType::Pointer OutputPathPointer;
171  typedef typename OutputPathType::ConstPointer OutputPathConstPointer;
172 
174  itkStaticConstMacro(InputImageDimension, unsigned int,
175  InputImageType::ImageDimension);
176 
185 
187  itkSetObjectMacro( Optimizer, OptimizerType );
188  itkGetConstObjectMacro( Optimizer, OptimizerType );
190 
193  itkSetObjectMacro( CostFunction, CostFunctionType );
194  itkGetConstObjectMacro( CostFunction, CostFunctionType );
196 
198  virtual void SetPathEndPoint( const PointType & point );
199 
201  virtual void AddPathEndPoint( const PointType & point );
202 
204  virtual void ClearPathEndPoints();
205 
209  itkSetMacro(TerminationValue, typename OptimizerType::MeasureType);
210  itkGetMacro(TerminationValue, typename OptimizerType::MeasureType);
212 
214  virtual void Execute( const itk::Object * object, const itk::EventObject & event );
215 
216 protected:
219  virtual void PrintSelf(std::ostream& os, Indent indent) const;
220 
222  void GenerateInputRequestedRegion();
223 
225  void GenerateData(void);
226 
228  virtual unsigned int GetNumberOfPathsToExtract( ) const;
229 
232  virtual InputImageType * ComputeArrivalFunction( );
233 
235  virtual const PointType & GetNextEndPoint( );
236 
240  std::vector<PointType> m_PointList;
241  unsigned int m_CurrentOutput;
242 
243 private:
244  ArrivalFunctionToPathFilter(const Self&); //purposely not implemented
245  void operator=(const Self&); //purposely not implemented
246 };
247 
248 } // end namespace itk
249 
250 #ifndef ITK_MANUAL_INSTANTIATION
251 #include "itkArrivalFunctionToPathFilter.hxx"
252 #endif
253 
254 #endif
This class is a cost function which queries an underlying image for the single value.
OutputPathType::ConstPointer OutputPathConstPointer
Represent a path of line segments through ND Space.
Light weight base class for most itk classes.
SingleValuedNonLinearOptimizer OptimizerType
ImageToPathFilter< TInputImage, TOutputPath > Superclass
Extracts a path from a Fast Marching arrival function.
A command to listen for Optimizer Iteration events.
void Execute(const itk::Object *object, const itk::EventObject &event)
This class is a base for the Optimization methods that optimize a single valued function.
Base class for filters that take an image as input and produce an path as output. ...
RegularStepGradientDescentOptimizer DefaultOptimizerType
InputImageType::ConstPointer InputImageConstPointer
Point< double, InputImageDimension > PointType
ContinuousIndex< double, InputImageDimension > ContinuousIndexType
Generic representation for an optimization method.
Definition: itkOptimizer.h:38
Abstraction of the Events used to communicating among filters and with GUIs.
SingleImageCostFunction< InputImageType > CostFunctionType
A templated class holding a point in n-Dimensional image space.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:57
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:71
Superclass for callback/observer methods.
Definition: itkCommand.h:44
void Execute(itk::Object *caller, const itk::EventObject &event)
ArrivalFunctionToPathCommand< Self > CommandType