Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef __itkShortestPathCostFunction_h
13 #define __itkShortestPathCostFunction_h
14 
15 #include "itkObject.h"
16 #include "itkObjectFactory.h"
17 #include "itkShapedNeighborhoodIterator.h"
18 
19 namespace itk
20 {
21  // \brief this is a pure virtual superclass for all cost functions used in itkShortestPathImageFilter
22  template <class TInputImageType>
23  class ShortestPathCostFunction : public Object
24  {
25  public:
28  typedef Object Superclass;
31  typedef ShapedNeighborhoodIterator<TInputImageType> ShapedNeighborhoodIteratorType;
32 
34  itkTypeMacro(ShortestPathCostFunction, Object);
35 
37  typedef TInputImageType ImageType;
38 
39  // More typdefs for convenience
40  typedef typename TInputImageType::Pointer ImagePointer;
41  typedef typename TInputImageType::ConstPointer ImageConstPointer;
42  typedef typename TInputImageType::PixelType PixelType;
43  typedef typename TInputImageType::IndexType IndexType;
44 
45  // \brief Set the input image.
46  itkSetConstObjectMacro(Image, TInputImageType);
47 
48  // \brief Calculate the cost for going from pixel p1 to pixel p2
49  virtual double GetCost(IndexType p1, IndexType p2) = 0;
50 
51  // \brief Return the minimal possible cost (needed for A*)
52  virtual double GetMinCost() = 0;
53 
54  // \brief Initialize the metric
55  virtual void Initialize() = 0;
56 
57  // \brief Set the starting index of a path
58  void SetStartIndex(const IndexType &index);
59 
60  // \brief Set the ending index of a path
61  void SetEndIndex(const IndexType &index);
62 
63  protected:
66  void PrintSelf(std::ostream &os, Indent indent) const override;
69 
70  private:
71  ShortestPathCostFunction(const Self &); // purposely not implemented
72  void operator=(const Self &); // purposely not implemented
73  };
74 
75 } // end namespace itk
76 
77 #include "itkShortestPathCostFunction.txx"
78 
79 #endif /* __itkShortestPathCostFunction_h */
itk::ShortestPathCostFunction::Self
ShortestPathCostFunction Self
Definition: itkShortestPathCostFunction.h:27
itk::ShortestPathCostFunction::ShapedNeighborhoodIteratorType
ShapedNeighborhoodIterator< TInputImageType > ShapedNeighborhoodIteratorType
Definition: itkShortestPathCostFunction.h:31
itk::ShortestPathCostFunction::Pointer
SmartPointer< Self > Pointer
Definition: itkShortestPathCostFunction.h:29
itk::ShortestPathCostFunction::Initialize
virtual void Initialize()=0
itk::ShortestPathCostFunction::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::ShortestPathCostFunction::GetCost
virtual double GetCost(IndexType p1, IndexType p2)=0
itk::SmartPointer< Self >
itk::ShortestPathCostFunction::~ShortestPathCostFunction
~ShortestPathCostFunction() override
Definition: itkShortestPathCostFunction.h:65
itk::ShortestPathCostFunction::SetStartIndex
void SetStartIndex(const IndexType &index)
itk::ShortestPathCostFunction::m_EndIndex
IndexType m_EndIndex
Definition: itkShortestPathCostFunction.h:68
itk::ShortestPathCostFunction::ImageType
TInputImageType ImageType
Definition: itkShortestPathCostFunction.h:34
itk::ShortestPathCostFunction::GetMinCost
virtual double GetMinCost()=0
itk::ShortestPathCostFunction::PixelType
TInputImageType::PixelType PixelType
Definition: itkShortestPathCostFunction.h:42
itk::ShortestPathCostFunction::m_Image
ImageConstPointer m_Image
Definition: itkShortestPathCostFunction.h:67
itk::ShortestPathCostFunction::IndexType
TInputImageType::IndexType IndexType
Definition: itkShortestPathCostFunction.h:43
itk::ShortestPathCostFunction::ImageConstPointer
TInputImageType::ConstPointer ImageConstPointer
Definition: itkShortestPathCostFunction.h:41
itk::ShortestPathCostFunction::ShortestPathCostFunction
ShortestPathCostFunction()
Definition: itkShortestPathCostFunction.h:64
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
itk::Image
class ITK_EXPORT Image
Definition: mitkGeometryClipImageFilter.h:25
itk::ShortestPathCostFunction::m_StartIndex
IndexType m_StartIndex
Definition: itkShortestPathCostFunction.h:68
itk::ShortestPathCostFunction
Definition: itkShortestPathCostFunction.h:23
itk::ShortestPathCostFunction::SetEndIndex
void SetEndIndex(const IndexType &index)
itk::ShortestPathCostFunction::ImagePointer
TInputImageType::Pointer ImagePointer
Definition: itkShortestPathCostFunction.h:40
itk::ShortestPathCostFunction::Superclass
Object Superclass
Definition: itkShortestPathCostFunction.h:28
itk::ShortestPathCostFunction::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkShortestPathCostFunction.h:30