ITK  5.0.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:
45  ITK_DISALLOW_COPY_AND_ASSIGN(ArrivalFunctionToPathCommand);
46 
51 
53  itkNewMacro( Self );
54 
56  using FilterType = TFilter;
57 
59  itkSetObjectMacro( Filter, FilterType );
60  itkGetConstObjectMacro( Filter, FilterType );
62 
64  void Execute(itk::Object *caller, const itk::EventObject & event) override
65  {
66  Execute( (const itk::Object *)caller, event);
67  }
68 
70  void Execute(const itk::Object * object, const itk::EventObject & event) override
71  {
72  if( ! itk::IterationEvent().CheckEvent( &event ) )
73  {
74  return;
75  }
76  // Pass event to Filter
77  if ( m_Filter.IsNotNull() )
78  {
79  m_Filter->Execute( object, event );
80  }
81  }
83 
84 protected:
87 
88 private:
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:
148  ITK_DISALLOW_COPY_AND_ASSIGN(ArrivalFunctionToPathFilter);
149 
155 
158 
160  itkNewMacro(Self);
161 
163  using InputImageType = TInputImage;
164  using InputImagePointer = typename InputImageType::Pointer;
165  using InputImageConstPointer = typename InputImageType::ConstPointer;
167  using InputImagePixelType = typename InputImageType::PixelType;
168 
170  using OutputPathType = TOutputPath;
171  using OutputPathPointer = typename OutputPathType::Pointer;
172  using OutputPathConstPointer = typename OutputPathType::ConstPointer;
173 
175  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
176 
185 
187  using PointsContainerType = std::vector < PointType>;
188 
190  itkSetObjectMacro( Optimizer, OptimizerType );
191  itkGetConstObjectMacro( Optimizer, OptimizerType );
193 
196  itkSetObjectMacro( CostFunction, CostFunctionType );
197  itkGetConstObjectMacro( CostFunction, CostFunctionType );
199 
201  virtual void SetPathEndPoint( const PointType & point );
202 
204  virtual void AddPathEndPoint( const PointType & point );
205 
207  virtual void ClearPathEndPoints();
208 
212  itkSetMacro(TerminationValue, typename OptimizerType::MeasureType);
213  itkGetMacro(TerminationValue, typename OptimizerType::MeasureType);
215 
217  virtual void Execute( const itk::Object * object, const itk::EventObject & event );
218 
219 protected:
221  ~ArrivalFunctionToPathFilter() override;
222  void PrintSelf(std::ostream& os, Indent indent) const override;
223 
225  void GenerateInputRequestedRegion() override;
226 
228  void GenerateData(void) override;
229 
231  virtual unsigned int GetNumberOfPathsToExtract( ) const;
232 
235  virtual InputImageType * ComputeArrivalFunction( );
236 
238  virtual const PointsContainerType & GetNextEndPoint( );
239 
243  std::vector<PointsContainerType> m_PointList;
244  unsigned int m_CurrentOutput;
245 };
246 
247 } // end namespace itk
248 
249 #ifndef ITK_MANUAL_INSTANTIATION
250 #include "itkArrivalFunctionToPathFilter.hxx"
251 #endif
252 
253 #endif
This class is a cost function which queries an underlying image for the single value.
Represent a path of line segments through ND Space.
Light weight base class for most itk classes.
typename OutputPathType::ConstPointer OutputPathConstPointer
void Execute(itk::Object *caller, const itk::EventObject &event) override
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:66
Extracts a path from a Fast Marching arrival function.
A command to listen for Optimizer Iteration events.
typename InputImageType::Pointer InputImagePointer
typename OutputPathType::Pointer OutputPathPointer
Definition: itkPathSource.h:63
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. ...
TOutputPath OutputPathType
Definition: itkPathSource.h:62
typename InputImageType::PixelType InputImagePixelType
Generic representation for an optimization method.
Definition: itkOptimizer.h:38
typename InputImageType::RegionType InputImageRegionType
Abstraction of the Events used to communicating among filters and with GUIs.
A templated class holding a point in n-Dimensional image space.
typename InputImageType::ConstPointer InputImageConstPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
class ITK_FORWARD_EXPORT Command
Definition: itkObject.h:41
Base class for most ITK classes.
Definition: itkObject.h:60
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
Superclass for callback/observer methods.
Definition: itkCommand.h:44
void Execute(const itk::Object *object, const itk::EventObject &event) override
std::vector< PointsContainerType > m_PointList