Medical Imaging Interaction Toolkit  2024.06.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::ImageLiveWireContourModelFilter::GenerateOutputInformation
void GenerateOutputInformation() override
Definition: mitkImageLiveWireContourModelFilter.h:118
mitk::ImageLiveWireContourModelFilter
Calculates a LiveWire contour between two points in an image.
Definition: mitkImageLiveWireContourModelFilter.h:48
mitkContourModelSource.h
mitk::ImageLiveWireContourModelFilter::CostFunctionType
itk::ShortestPathCostFunctionLiveWire< InternalImageType > CostFunctionType
Definition: mitkImageLiveWireContourModelFilter.h:61
mitkImage.h
itk::ShortestPathCostFunctionLiveWire
Cost function for LiveWire purposes. Specific features are considered to calculate cummulative costs ...
Definition: itkShortestPathCostFunctionLiveWire.h:40
mitkImageCast.h
mitkImageAccessByItk.h
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
mitk::ImageLiveWireContourModelFilter::m_CostFunction
CostFunctionType::Pointer m_CostFunction
The cost function to compute costs between two pixels.
Definition: mitkImageLiveWireContourModelFilter.h:137
itk::SmartPointer< Self >
mitk::ImageLiveWireContourModelFilter::ShortestPathType
std::vector< itk::Index< 2 > > ShortestPathType
Definition: mitkImageLiveWireContourModelFilter.h:62
mitk::ImageLiveWireContourModelFilter::m_StartPointInIndex
mitk::Point3D m_StartPointInIndex
Start point in index.
Definition: mitkImageLiveWireContourModelFilter.h:131
mitk::ImageLiveWireContourModelFilter::InputType
mitk::Image InputType
Definition: mitkImageLiveWireContourModelFilter.h:57
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ImageLiveWireContourModelFilter::OutputType
ContourModel OutputType
Definition: mitkImageLiveWireContourModelFilter.h:53
mitkContourModel.h
itkShortestPathCostFunctionLiveWire.h
mitk::ImageLiveWireContourModelFilter::InternalImageType
itk::Image< float, 2 > InternalImageType
Definition: mitkImageLiveWireContourModelFilter.h:59
mitk::ImageLiveWireContourModelFilter::m_StartPoint
mitk::Point3D m_StartPoint
start point in worldcoordinates
Definition: mitkImageLiveWireContourModelFilter.h:125
mitk::ImageLiveWireContourModelFilter::SetUseCostFunction
void SetUseCostFunction(bool doUseCostFunction)
Definition: mitkImageLiveWireContourModelFilter.h:111
mitk::BaseDataSource
Superclass of all classes generating some kind of mitk::BaseData.
Definition: mitkBaseDataSource.h:71
mitk::ImageLiveWireContourModelFilter::ShortestPathImageFilterType
itk::ShortestPathImageFilter< InternalImageType, InternalImageType > ShortestPathImageFilterType
Definition: mitkImageLiveWireContourModelFilter.h:60
mitk::Point< ScalarType, 3 >
mitk::ImageLiveWireContourModelFilter::m_ShortestPathFilter
ShortestPathImageFilterType::Pointer m_ShortestPathFilter
Shortest path filter according to cost function m_CostFunction.
Definition: mitkImageLiveWireContourModelFilter.h:140
itkShortestPathImageFilter.h
mitk::ImageLiveWireContourModelFilter::m_InternalImage
InternalImageType::Pointer m_InternalImage
Definition: mitkImageLiveWireContourModelFilter.h:154
mitk::ContourModel
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
Definition: mitkContourModel.h:47
mitkCommon.h
MITKSEGMENTATION_EXPORT
#define MITKSEGMENTATION_EXPORT
Definition: MitkSegmentationExports.h:15
mitk::ImageLiveWireContourModelFilter::m_EndPointInIndex
mitk::Point3D m_EndPointInIndex
End point in index.
Definition: mitkImageLiveWireContourModelFilter.h:134
mitk::ImageLiveWireContourModelFilter::OutputTypePointer
OutputType::Pointer OutputTypePointer
Definition: mitkImageLiveWireContourModelFilter.h:56
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
MitkSegmentationExports.h
mitk::ContourModelSource
Superclass of all classes generating ContourModels.
Definition: mitkContourModelSource.h:26
itk::ShortestPathImageFilter
Definition: itkShortestPathImageFilter.h:52
mitk::ImageLiveWireContourModelFilter::m_TimeStep
unsigned int m_TimeStep
Definition: mitkImageLiveWireContourModelFilter.h:145
mitk::ImageLiveWireContourModelFilter::m_EndPoint
mitk::Point3D m_EndPoint
end point in woorldcoordinates
Definition: mitkImageLiveWireContourModelFilter.h:128
mitk::ImageLiveWireContourModelFilter::m_UseDynamicCostMap
bool m_UseDynamicCostMap
Flag to use a dynamic cost map or not.
Definition: mitkImageLiveWireContourModelFilter.h:143