Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
itkShortestPathCostFunction.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef __itkShortestPathCostFunction_h
17 #define __itkShortestPathCostFunction_h
18 
19 #include "itkObject.h"
20 #include "itkObjectFactory.h"
21 #include "itkShapedNeighborhoodIterator.h"
22 
23 namespace itk
24 {
25  // \brief this is a pure virtual superclass for all cost functions used in itkShortestPathImageFilter
26  template <class TInputImageType>
27  class ShortestPathCostFunction : public Object
28  {
29  public:
32  typedef Object Superclass;
35  typedef ShapedNeighborhoodIterator<TInputImageType> ShapedNeighborhoodIteratorType;
36 
38  itkTypeMacro(ShortestPathCostFunction, Object);
39 
41  typedef TInputImageType ImageType;
42 
43  // More typdefs for convenience
47  typedef typename TInputImageType::IndexType IndexType;
48 
49  // \brief Set the input image.
50  itkSetConstObjectMacro(Image, TInputImageType);
51 
52  // \brief Calculate the cost for going from pixel p1 to pixel p2
53  virtual double GetCost(IndexType p1, IndexType p2) = 0;
54 
55  // \brief Return the minimal possible cost (needed for A*)
56  virtual double GetMinCost() = 0;
57 
58  // \brief Initialize the metric
59  virtual void Initialize() = 0;
60 
61  // \brief Set the starting index of a path
62  void SetStartIndex(const IndexType &index);
63 
64  // \brief Set the ending index of a path
65  void SetEndIndex(const IndexType &index);
66 
67  protected:
70  void PrintSelf(std::ostream &os, Indent indent) const override;
71  ImageConstPointer m_Image;
73 
74  private:
75  ShortestPathCostFunction(const Self &); // purposely not implemented
76  void operator=(const Self &); // purposely not implemented
77  };
78 
79 } // end namespace itk
80 
82 
83 #endif /* __itkShortestPathCostFunction_h */
itk::SmartPointer< Self > Pointer
TInputImageType::IndexType IndexType
itk::SmartPointer< const Self > ConstPointer
SmartPointer< const Self > ConstPointer
void SetEndIndex(const IndexType &index)
class ITK_EXPORT Image
virtual double GetMinCost()=0
TInputImageType::ConstPointer ImageConstPointer
ShapedNeighborhoodIterator< TInputImageType > ShapedNeighborhoodIteratorType
unsigned short PixelType
void SetStartIndex(const IndexType &index)
TInputImageType::PixelType PixelType
void PrintSelf(std::ostream &os, Indent indent) const override
virtual double GetCost(IndexType p1, IndexType p2)=0