ITK  4.13.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) ITK_OVERRIDE
63  {
64  Execute( (const itk::Object *)caller, event);
65  }
66 
68  void Execute(const itk::Object * object, const itk::EventObject & event) ITK_OVERRIDE
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:
87  ITK_DISALLOW_COPY_AND_ASSIGN(ArrivalFunctionToPathCommand);
88 
89  typename FilterType::Pointer m_Filter;
90 };
91 
92 
142 template <class TInputImage,
144 class ITK_EXPORT ArrivalFunctionToPathFilter :
145  public ImageToPathFilter<TInputImage,TOutputPath>
146 {
147 public:
153 
156 
158  itkNewMacro(Self);
159 
161  typedef TInputImage InputImageType;
162  typedef typename InputImageType::Pointer InputImagePointer;
163  typedef typename InputImageType::ConstPointer InputImageConstPointer;
164  typedef typename InputImageType::RegionType InputImageRegionType;
165  typedef typename InputImageType::PixelType InputImagePixelType;
166 
168  typedef TOutputPath OutputPathType;
169  typedef typename OutputPathType::Pointer OutputPathPointer;
170  typedef typename OutputPathType::ConstPointer OutputPathConstPointer;
171 
173  itkStaticConstMacro(InputImageDimension, unsigned int,
174  InputImageType::ImageDimension);
175 
184 
186  itkSetObjectMacro( Optimizer, OptimizerType );
187  itkGetConstObjectMacro( Optimizer, OptimizerType );
189 
192  itkSetObjectMacro( CostFunction, CostFunctionType );
193  itkGetConstObjectMacro( CostFunction, CostFunctionType );
195 
197  virtual void SetPathEndPoint( const PointType & point );
198 
200  virtual void AddPathEndPoint( const PointType & point );
201 
203  virtual void ClearPathEndPoints();
204 
208  itkSetMacro(TerminationValue, typename OptimizerType::MeasureType);
209  itkGetMacro(TerminationValue, typename OptimizerType::MeasureType);
211 
213  virtual void Execute( const itk::Object * object, const itk::EventObject & event );
214 
215 protected:
218  virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
219 
221  void GenerateInputRequestedRegion() ITK_OVERRIDE;
222 
224  void GenerateData(void) ITK_OVERRIDE;
225 
227  virtual unsigned int GetNumberOfPathsToExtract( ) const;
228 
231  virtual InputImageType * ComputeArrivalFunction( );
232 
234  virtual const PointType & GetNextEndPoint( );
235 
236  typename CostFunctionType::Pointer m_CostFunction;
237  typename OptimizerType::Pointer m_Optimizer;
238  typename OptimizerType::MeasureType m_TerminationValue;
239  std::vector<PointType> m_PointList;
240  unsigned int m_CurrentOutput;
241 
242 private:
243  ITK_DISALLOW_COPY_AND_ASSIGN(ArrivalFunctionToPathFilter);
244 };
245 
246 } // end namespace itk
247 
248 #ifndef ITK_MANUAL_INSTANTIATION
249 #include "itkArrivalFunctionToPathFilter.hxx"
250 #endif
251 
252 #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
void Execute(itk::Object *caller, const itk::EventObject &event) override
Extracts a path from a Fast Marching arrival function.
A command to listen for Optimizer Iteration events.
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:59
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:72
Superclass for callback/observer methods.
Definition: itkCommand.h:44
void Execute(const itk::Object *object, const itk::EventObject &event) override
ArrivalFunctionToPathCommand< Self > CommandType