MCPcopy Create free account
hub / github.com/MITK/MITK / GenerateData

Method GenerateData

Modules/SurfaceInterpolation/src/mitkReduceContourSetFilter.cpp:46–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void mitk::ReduceContourSetFilter::GenerateData()
47{
48 unsigned int numberOfInputs = this->GetNumberOfIndexedInputs();
49 unsigned int numberOfOutputs(0);
50
51 vtkSmartPointer<vtkPolyData> newPolyData;
52 vtkSmartPointer<vtkCellArray> newPolygons;
53 vtkSmartPointer<vtkPoints> newPoints;
54
55 // For the purpose of evaluation
56 // unsigned int numberOfPointsBefore (0);
57 m_NumberOfPointsAfterReduction = 0;
58
59 for (unsigned int i = 0; i < numberOfInputs; i++)
60 {
61 auto *currentSurface = this->GetInput(i);
62 vtkSmartPointer<vtkPolyData> polyData = currentSurface->GetVtkPolyData();
63
64 newPolyData = vtkSmartPointer<vtkPolyData>::New();
65 newPolygons = vtkSmartPointer<vtkCellArray>::New();
66 newPoints = vtkSmartPointer<vtkPoints>::New();
67
68 vtkSmartPointer<vtkCellArray> existingPolys = polyData->GetPolys();
69
70 vtkSmartPointer<vtkPoints> existingPoints = polyData->GetPoints();
71
72 existingPolys->InitTraversal();
73
74 const vtkIdType *cell(nullptr);
75 vtkIdType cellSize(0);
76
77 for (existingPolys->InitTraversal(); existingPolys->GetNextCell(cellSize, cell);)
78 {
79 bool incorporatePolygon =
80 this->CheckForIntersection(cell, cellSize, existingPoints, /*numberOfIntersections, intersectionPoints, */ i);
81 if (!incorporatePolygon)
82 continue;
83
84 vtkSmartPointer<vtkPolygon> newPolygon = vtkSmartPointer<vtkPolygon>::New();
85
86 if (m_ReductionType == NTH_POINT)
87 {
88 this->ReduceNumberOfPointsByNthPoint(cellSize, cell, existingPoints, newPolygon, newPoints);
89 if (newPolygon->GetPointIds()->GetNumberOfIds() != 0)
90 {
91 newPolygons->InsertNextCell(newPolygon);
92 }
93 }
94 else if (m_ReductionType == DOUGLAS_PEUCKER)
95 {
96 this->ReduceNumberOfPointsByDouglasPeucker(cellSize, cell, existingPoints, newPolygon, newPoints);
97 if (newPolygon->GetPointIds()->GetNumberOfIds() > 3)
98 {
99 newPolygons->InsertNextCell(newPolygon);
100 }
101 }
102
103 // Again for evaluation

Callers

nothing calls this directly

Calls 10

CheckForIntersectionMethod · 0.95
GetPointerMethod · 0.80
SetVtkPolyDataMethod · 0.80
NewFunction · 0.50
GetInputMethod · 0.45
GetVtkPolyDataMethod · 0.45
SetPointsMethod · 0.45
ProgressMethod · 0.45

Tested by

no test coverage detected