Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkImageLiveWireContourModelFilter.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 
13 #ifndef _mitkImageLiveWireContourModelFilter_h__
14 #define _mitkImageLiveWireContourModelFilter_h__
15 
16 #include "mitkCommon.h"
17 #include "mitkContourModel.h"
18 #include "mitkContourModelSource.h"
20 
21 #include <mitkImage.h>
22 #include <mitkImageAccessByItk.h>
23 #include <mitkImageCast.h>
24 
27 
28 namespace mitk
29 {
50  {
51  public:
53  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
54 
56  typedef OutputType::Pointer OutputTypePointer;
57  typedef mitk::Image InputType;
58 
59  typedef itk::Image<float, 2> InternalImageType;
60  typedef itk::ShortestPathImageFilter<InternalImageType, InternalImageType> ShortestPathImageFilterType;
61  typedef itk::ShortestPathCostFunctionLiveWire<InternalImageType> CostFunctionType;
62  typedef std::vector<itk::Index<2>> ShortestPathType;
63 
65  itkSetMacro(StartPoint, mitk::Point3D);
66  itkGetMacro(StartPoint, mitk::Point3D);
67 
69  itkSetMacro(EndPoint, mitk::Point3D);
70  itkGetMacro(EndPoint, mitk::Point3D);
71 
76  itkSetMacro(UseDynamicCostMap, bool);
77  itkGetMacro(UseDynamicCostMap, bool);
78 
81  itkSetMacro(TimeStep, unsigned int);
82  itkGetMacro(TimeStep, unsigned int);
83 
86  void ClearRepulsivePoints();
87 
90  void SetRepulsivePoints(const ShortestPathType &points);
91 
94  void AddRepulsivePoint(const itk::Index<2> &idx);
95 
98  void RemoveRepulsivePoint(const itk::Index<2> &idx);
99 
100  virtual void SetInput(const InputType *input);
101 
102  using Superclass::SetInput;
103  virtual void SetInput(unsigned int idx, const InputType *input);
104 
105  const InputType *GetInput(void);
106 
107  const InputType *GetInput(unsigned int idx);
108 
109  virtual OutputType *GetOutput();
110 
111  virtual void DumpMaskImage();
112 
114  bool CreateDynamicCostMap(mitk::ContourModel *path = nullptr);
115 
116  protected:
118 
119  ~ImageLiveWireContourModelFilter() override;
120 
121  void GenerateOutputInformation() override{};
122 
123  void GenerateData() override;
124 
125  void UpdateLiveWire();
126 
129 
132 
135 
138 
141 
144 
147 
148  unsigned int m_TimeStep;
149 
150  template <typename TPixel, unsigned int VImageDimension>
151  void ItkPreProcessImage(const itk::Image<TPixel, VImageDimension> *inputImage);
152 
153  template <typename TPixel, unsigned int VImageDimension>
154  void CreateDynamicCostMapByITK(const itk::Image<TPixel, VImageDimension> *inputImage,
155  mitk::ContourModel *path = nullptr);
156 
157  InternalImageType::Pointer m_InternalImage;
158  };
159 }
160 
161 #endif
mitk::Point3D m_EndPoint
end point in woorldcoordinates
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
CostFunctionType::Pointer m_CostFunction
The cost function to compute costs between two pixels.
Superclass of all classes generating some kind of mitk::BaseData.
STL namespace.
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
Superclass of all classes generating ContourModels.
ShortestPathImageFilterType::Pointer m_ShortestPathFilter
Shortest path filter according to cost function m_CostFunction.
mitk::Point3D m_StartPoint
start point in worldcoordinates
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Image class for storing images.
Definition: mitkImage.h:72
Calculates a LiveWire contour between two points in an image.
bool m_UseDynamicCostMap
Flag to use a dynmic cost map or not.
Cost function for LiveWire purposes. Specific features are considered to calculate cummulative costs ...
mitk::Point3D m_StartPointInIndex
Start point in index.
itk::ProcessObject Superclass