Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkReduceContourSetFilter.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 mitkReduceContourSetFilter_h
14 #define mitkReduceContourSetFilter_h
15 
16 #include "mitkProgressBar.h"
17 #include "mitkSurface.h"
20 
21 #include "vtkCellArray.h"
22 #include "vtkMath.h"
23 #include "vtkPoints.h"
24 #include "vtkPolyData.h"
25 #include "vtkPolygon.h"
26 #include "vtkSmartPointer.h"
27 
28 #include <stack>
29 
30 namespace mitk
31 {
53  {
54  public:
56  {
58  DOUGLAS_PEUCKER
59  };
60 
61  struct LineSegment
62  {
63  unsigned int StartIndex;
64  unsigned int EndIndex;
65  };
66 
68  itkFactorylessNewMacro(Self);
69  itkCloneMacro(Self);
70  itkSetMacro(MinSpacing, double);
71  itkSetMacro(MaxSpacing, double);
72  itkSetMacro(ReductionType, Reduction_Type);
73  itkSetMacro(StepSize, unsigned int);
74  itkSetMacro(Tolerance, double);
75 
76  itkGetMacro(NumberOfPointsAfterReduction, unsigned int);
77 
78  // Resets the filter, i.e. removes all inputs and outputs
79  void Reset();
80 
86  void SetUseProgressBar(bool);
87 
88  using itk::ProcessObject::SetInput;
89  void SetInput(const mitk::Surface *surface) override;
90  void SetInput(unsigned int idx, const mitk::Surface *surface) override;
91 
97  void SetProgressStepSize(unsigned int stepSize);
98 
99  protected:
101  ~ReduceContourSetFilter() override;
102  void GenerateData() override;
103  void GenerateOutputInformation() override;
104 
105  private:
106  void ReduceNumberOfPointsByNthPoint(
107  vtkIdType cellSize, const vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints);
108 
109  void ReduceNumberOfPointsByDouglasPeucker(
110  vtkIdType cellSize, const vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints);
111 
112  bool CheckForIntersection(
113  const vtkIdType *currentCell,
114  vtkIdType currentCellSize,
115  vtkPoints *currentPoints,
116  /*vtkIdType numberOfIntersections, vtkIdType* intersectionPoints,*/ unsigned int currentInputIndex);
117 
118  double m_MinSpacing;
119  double m_MaxSpacing;
120 
121  Reduction_Type m_ReductionType;
122  unsigned int m_StepSize;
123  double m_Tolerance;
124  unsigned int m_MaxSegmentLenght;
125 
126  bool m_UseProgressBar;
127  unsigned int m_ProgressStepSize;
128 
129  unsigned int m_NumberOfPointsAfterReduction;
130 
131  }; // class
132 
133 } // namespace
134 #endif
mitk::ReduceContourSetFilter::LineSegment
Definition: mitkReduceContourSetFilter.h:61
mitk::ReduceContourSetFilter::LineSegment::StartIndex
unsigned int StartIndex
Definition: mitkReduceContourSetFilter.h:63
MITKSURFACEINTERPOLATION_EXPORT
#define MITKSURFACEINTERPOLATION_EXPORT
Definition: MitkSurfaceInterpolationExports.h:15
mitkSurfaceToSurfaceFilter.h
mitk::Surface
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitkSurface.h
mitk::BaseDataSource
Superclass of all classes generating some kind of mitk::BaseData.
Definition: mitkBaseDataSource.h:71
mitk::ReduceContourSetFilter::LineSegment::EndIndex
unsigned int EndIndex
Definition: mitkReduceContourSetFilter.h:64
mitk::SurfaceToSurfaceFilter
Superclass of all classes getting surfaces (instances of class Surface) as input and generating surfa...
Definition: mitkSurfaceToSurfaceFilter.h:31
mitk::ReduceContourSetFilter::NTH_POINT
@ NTH_POINT
Definition: mitkReduceContourSetFilter.h:57
MitkSurfaceInterpolationExports.h
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitkProgressBar.h
mitk::ReduceContourSetFilter::Reduction_Type
Reduction_Type
Definition: mitkReduceContourSetFilter.h:55
mitk::ReduceContourSetFilter
A filter that reduces the number of points of contours represented by a mitk::Surface.
Definition: mitkReduceContourSetFilter.h:52