Medical Imaging Interaction Toolkit  2021.10.00
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 {
49  {
50  public:
52  itkFactorylessNewMacro(Self);
53  itkCloneMacro(Self);
54 
55  typedef ContourModel OutputType;
58 
59  typedef itk::Image<float, 2> InternalImageType;
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  void ClearRepulsivePoints();
82 
85  void SetRepulsivePoints(const ShortestPathType &points);
86 
89  void AddRepulsivePoint(const itk::Index<2> &idx);
90 
93  void RemoveRepulsivePoint(const itk::Index<2> &idx);
94 
95  virtual void SetInput(const InputType *input);
96 
97  using Superclass::SetInput;
98  virtual void SetInput(unsigned int idx, const InputType *input);
99 
100  const InputType *GetInput(void);
101 
102  const InputType *GetInput(unsigned int idx);
103 
104  virtual OutputType *GetOutput();
105 
106  virtual void DumpMaskImage();
107 
109  bool CreateDynamicCostMap(mitk::ContourModel *path = nullptr);
110 
111  void SetUseCostFunction(bool doUseCostFunction) { m_ShortestPathFilter->SetUseCostFunction(doUseCostFunction); };
112 
113  protected:
115 
117 
118  void GenerateOutputInformation() override{};
119 
120  void GenerateData() override;
121 
122  void UpdateLiveWire();
123 
126 
129 
132 
135 
138 
141 
144 
145  unsigned int m_TimeStep;
146 
147  template <typename TPixel, unsigned int VImageDimension>
148  void ItkPreProcessImage(const itk::Image<TPixel, VImageDimension> *inputImage);
149 
150  template <typename TPixel, unsigned int VImageDimension>
151  void CreateDynamicCostMapByITK(const itk::Image<TPixel, VImageDimension> *inputImage,
152  mitk::ContourModel *path = nullptr);
153 
154  InternalImageType::Pointer m_InternalImage;
155  };
156 }
157 
158 #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.
#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:36
Image class for storing images.
Definition: mitkImage.h:69
itk::ShortestPathImageFilter< InternalImageType, InternalImageType > ShortestPathImageFilterType
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 ...
itk::ShortestPathCostFunctionLiveWire< InternalImageType > CostFunctionType
mitk::Point3D m_StartPointInIndex
Start point in index.