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
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,
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 mitkReduceContourSetFilter_h_Included
18 #define mitkReduceContourSetFilter_h_Included
19 
20 #include "mitkProgressBar.h"
21 #include "mitkSurface.h"
24 
25 #include "vtkCellArray.h"
26 #include "vtkMath.h"
27 #include "vtkPoints.h"
28 #include "vtkPolyData.h"
29 #include "vtkPolygon.h"
30 #include "vtkSmartPointer.h"
31 
32 #include <stack>
33 
34 namespace mitk
35 {
57  {
58  public:
60  {
62  DOUGLAS_PEUCKER
63  };
64 
65  struct LineSegment
66  {
67  unsigned int StartIndex;
68  unsigned int EndIndex;
69  };
70 
72  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
73 
74  itkSetMacro(MinSpacing, double);
75  itkSetMacro(MaxSpacing, double);
76  itkSetMacro(ReductionType, Reduction_Type);
77  itkSetMacro(StepSize, unsigned int);
78  itkSetMacro(Tolerance, double);
79 
80  itkGetMacro(NumberOfPointsAfterReduction, unsigned int);
81 
82  // Resets the filter, i.e. removes all inputs and outputs
83  void Reset();
84 
90  void SetUseProgressBar(bool);
91 
92  using itk::ProcessObject::SetInput;
93  virtual void SetInput(const mitk::Surface *surface);
94  virtual void SetInput(unsigned int idx, const mitk::Surface *surface);
95 
101  void SetProgressStepSize(unsigned int stepSize);
102 
103  protected:
105  virtual ~ReduceContourSetFilter();
106  virtual void GenerateData() override;
107  virtual void GenerateOutputInformation() override;
108 
109  private:
110  void ReduceNumberOfPointsByNthPoint(
111  vtkIdType cellSize, vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints);
112 
113  void ReduceNumberOfPointsByDouglasPeucker(
114  vtkIdType cellSize, vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints);
115 
116  bool CheckForIntersection(
117  vtkIdType *currentCell,
118  vtkIdType currentCellSize,
119  vtkPoints *currentPoints,
120  /*vtkIdType numberOfIntersections, vtkIdType* intersectionPoints,*/ unsigned int currentInputIndex);
121 
122  double m_MinSpacing;
123  double m_MaxSpacing;
124 
125  Reduction_Type m_ReductionType;
126  unsigned int m_StepSize;
127  double m_Tolerance;
128  unsigned int m_MaxSegmentLenght;
129 
130  bool m_UseProgressBar;
131  unsigned int m_ProgressStepSize;
132 
133  unsigned int m_NumberOfPointsAfterReduction;
134 
135  }; // class
136 
137 } // namespace
138 #endif
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
A filter that reduces the number of points of contours represented by a mitk::Surface.
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKSURFACEINTERPOLATION_EXPORT
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Superclass of all classes getting surfaces (instances of class Surface) as input and generating surfa...