Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
itkShortestPathCostFunctionLiveWire.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 
17 #ifndef __itkShortestPathCostFunctionLiveWire_h
18 #define __itkShortestPathCostFunctionLiveWire_h
19 
21 
22 #include "itkImageRegionConstIterator.h"
23 
24 namespace itk
25 {
43  template <class TInputImageType>
44  class ITK_EXPORT ShortestPathCostFunctionLiveWire : public ShortestPathCostFunction<TInputImageType>
45  {
46  public:
52  typedef itk::ImageRegionConstIterator<TInputImageType> ConstIteratorType;
53 
55  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
56 
59 
60  typedef itk::Image<unsigned char, 2> UnsignedCharImageType;
61  typedef itk::Image<float, 2> FloatImageType;
62 
63  typedef float ComponentType;
64  typedef itk::CovariantVector<ComponentType, 2> OutputPixelType;
65  typedef itk::Image<OutputPixelType, 2> VectorOutputImageType;
66 
67  typedef typename TInputImageType::IndexType IndexType;
68  typedef TInputImageType ImageType;
69  typedef itk::ImageRegion<2> RegionType;
70 
72  virtual double GetCost(IndexType p1, IndexType p2);
73 
75  virtual double GetMinCost();
76 
78  virtual void Initialize();
79 
81  virtual void AddRepulsivePoint(const IndexType &index);
82 
84  virtual void RemoveRepulsivePoint(const IndexType &index);
85 
87  virtual void ClearRepulsivePoints();
88 
89  itkSetMacro(RequestedRegion, RegionType);
90  itkGetMacro(RequestedRegion, RegionType);
91 
92  // Set/Get function for sigma parameter
93  itkSetMacro(UseApproximateGradient, bool);
94  itkGetMacro(UseApproximateGradient, bool);
95 
96  virtual void SetImage(const TInputImageType *_arg);
97 
98  void SetDynamicCostMap(std::map<int, int> &costMap)
99  {
100  this->m_CostMap = costMap;
101  this->m_UseCostMap = true;
102  this->m_MaxMapCosts = -1;
103  this->Modified();
104  }
105 
106  void SetUseCostMap(bool useCostMap) { this->m_UseCostMap = useCostMap; }
110  void SetCostMapMaximum(double max) { this->m_MaxMapCosts = max; }
112  {
113  MAPSCALEFACTOR = 10
114  };
115 
125  static double Gaussian(double x, double xOfGaussian, double yOfGaussian);
126 
127  const UnsignedCharImageType *GetMaskImage() { return this->m_MaskImage.GetPointer(); };
128  const FloatImageType *GetGradientMagnitudeImage() { return this->m_GradientMagnitudeImage.GetPointer(); };
129  const FloatImageType *GetEdgeImage() { return this->m_EdgeImage.GetPointer(); };
130  const VectorOutputImageType *GetGradientImage() { return this->m_GradientImage.GetPointer(); };
131  protected:
133 
135 
136  FloatImageType::Pointer m_GradientMagnitudeImage;
140 
141  double minCosts;
142 
144 
146 
149 
151 
153 
155 
157 
158  std::map<int, int> m_CostMap;
159 
161 
163 
164  private:
165  double SigmoidFunction(double I, double max, double min, double alpha, double beta);
166  };
167 
168 } // end namespace itk
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
172 #endif
173 
174 #endif /* __itkShortestPathCostFunctionLiveWire_h */
itk::SmartPointer< Self > Pointer
STL namespace.
TInputImageType::IndexType IndexType
class ITK_EXPORT Image
itk::ImageRegionConstIterator< TInputImageType > ConstIteratorType
static T max(T x, T y)
Definition: svm.cpp:70
static T min(T x, T y)
Definition: svm.cpp:67
Cost function for LiveWire purposes. Specific features are considered to calculate cummulative costs ...
itk::CovariantVector< ComponentType, 2 > OutputPixelType
TInputImageType::PixelType PixelType
ShortestPathCostFunction< TInputImageType > Superclass
void SetCostMapMaximum(double max)
Set the maximum of the dynamic cost map to save computation time.