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

Method Remesh

Modules/Remeshing/src/mitkRemeshing.cpp:67–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67mitk::Surface::Pointer mitk::Remesh(const Surface* surface,
68 TimeStepType t,
69 int numVertices,
70 double gradation,
71 int subsampling,
72 double edgeSplitting,
73 int optimizationLevel,
74 bool forceManifold,
75 bool boundaryFixing)
76{
77 ValidateSurface(surface, t);
78
79 MITK_INFO << "Start remeshing...";
80
81 auto surfacePolyData = vtkSmartPointer<vtkPolyData>::New();
82 surfacePolyData->DeepCopy(const_cast<Surface *>(surface)->GetVtkPolyData(t));
83
84 auto mesh = vtkSmartPointer<vtkSurface>::New();
85
86 mesh->CreateFromPolyData(surfacePolyData);
87 mesh->GetCellData()->Initialize();
88 mesh->GetPointData()->Initialize();
89
90 mesh->DisplayMeshProperties();
91
92 if (numVertices == 0)
93 numVertices = surfacePolyData->GetNumberOfPoints();
94
95 if (edgeSplitting != 0.0)
96 mesh->SplitLongEdges(edgeSplitting);
97
98 auto remesher = vtkSmartPointer<vtkIsotropicDiscreteRemeshing>::New();
99
100 remesher->GetMetric()->SetGradation(gradation);
101 remesher->SetBoundaryFixing(boundaryFixing);
102 remesher->SetConsoleOutput(1);
103 remesher->SetForceManifold(forceManifold);
104 remesher->SetInput(mesh);
105 remesher->SetNumberOfClusters(numVertices);
106 remesher->SetSubsamplingThreshold(subsampling);
107
108 remesher->Remesh();
109
110 // Optimization: Minimize distance between input surface and remeshed surface
111 if (optimizationLevel != 0)
112 {
113 ClustersQuadrics clustersQuadrics(numVertices);
114
115 auto faceList = vtkSmartPointer<vtkIdList>::New();
116 vtkSmartPointer<vtkIntArray> clustering = remesher->GetClustering();
117 vtkSmartPointer<vtkSurface> remesherInput = remesher->GetInput();
118 int clusteringType = remesher->GetClusteringType();
119 int numItems = remesher->GetNumberOfItems();
120 int numMisclassifiedItems = 0;
121
122 for (int i = 0; i < numItems; ++i)
123 {
124 int cluster = clustering->GetValue(i);

Callers

nothing calls this directly

Calls 15

ValidateSurfaceFunction · 0.85
DeepCopyMethod · 0.80
GetNumberOfPointsMethod · 0.80
SetVtkPolyDataMethod · 0.80
NewFunction · 0.50
GetVtkPolyDataMethod · 0.45
InitializeMethod · 0.45
SetInputMethod · 0.45
GetInputMethod · 0.45
GetValueMethod · 0.45
dataMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected