Commit b0b508db019f378d81cf207026c7422ca6fa992f
1 parent
0d3c6a41
Exists in
master
and in
5 other branches
Applying smooth to surface
Showing
2 changed files
with
30 additions
and
8 deletions
Show diff stats
invesalius/data/surface.py
... | ... | @@ -496,6 +496,32 @@ class SurfaceManager(): |
496 | 496 | clean.PointMergingOn() |
497 | 497 | polydata = clean.GetOutput() |
498 | 498 | |
499 | + smoother = vtk.vtkWindowedSincPolyDataFilter() | |
500 | + smoother.SetInput(polydata) | |
501 | + smoother.SetNumberOfIterations(smooth_iterations) | |
502 | + smoother.SetFeatureAngle(120) | |
503 | + smoother.BoundarySmoothingOn() | |
504 | + smoother.SetPassBand(0.1) | |
505 | + #smoother.FeatureEdgeSmoothingOn() | |
506 | + #smoother.NonManifoldSmoothingOn() | |
507 | + #smoother.NormalizeCoordinatesOn() | |
508 | + smoother.Update() | |
509 | + polydata = smoother.GetOutput() | |
510 | + | |
511 | + print "Normals" | |
512 | + normals = vtk.vtkPolyDataNormals() | |
513 | + normals.SetInput(polydata) | |
514 | + normals.SetFeatureAngle(80) | |
515 | + normals.AutoOrientNormalsOn() | |
516 | + polydata = normals.GetOutput() | |
517 | + #decimation = vtk.vtkDecimatePro() | |
518 | + #decimation.SetInput(polydata) | |
519 | + #decimation.SetTargetReduction(0.3) | |
520 | + #decimation.PreserveTopologyOn() | |
521 | + #decimation.SplittingOff() | |
522 | + #decimation.BoundaryVertexDeletionOff() | |
523 | + #polydata = decimation.GetOutput() | |
524 | + | |
499 | 525 | # Improve performance |
500 | 526 | stripper = vtk.vtkStripper() |
501 | 527 | stripper.SetInput(polydata) | ... | ... |
invesalius/data/surface_process.py
... | ... | @@ -71,12 +71,11 @@ class SurfaceProcess(multiprocessing.Process): |
71 | 71 | mcubes.SetInput(image) |
72 | 72 | mcubes.SetValue(0, self.min_value) |
73 | 73 | mcubes.SetValue(1, self.max_value) |
74 | - mcubes.ComputeScalarsOn() | |
75 | - mcubes.ComputeGradientsOn() | |
76 | - mcubes.ComputeNormalsOn() | |
74 | + mcubes.ComputeScalarsOff() | |
75 | + mcubes.ComputeGradientsOff() | |
76 | + mcubes.ComputeNormalsOff() | |
77 | 77 | polydata = mcubes.GetOutput() |
78 | 78 | |
79 | - | |
80 | 79 | triangle = vtk.vtkTriangleFilter() |
81 | 80 | triangle.SetInput(polydata) |
82 | 81 | triangle.Update() |
... | ... | @@ -93,7 +92,7 @@ class SurfaceProcess(multiprocessing.Process): |
93 | 92 | decimation = vtk.vtkDecimatePro() |
94 | 93 | decimation.SetInput(polydata) |
95 | 94 | decimation.SetTargetReduction(0.3) |
96 | - decimation.PreserveTopologyOn() | |
95 | + #decimation.PreserveTopologyOn() | |
97 | 96 | decimation.SplittingOff() |
98 | 97 | decimation.BoundaryVertexDeletionOff() |
99 | 98 | polydata = decimation.GetOutput() |
... | ... | @@ -133,8 +132,5 @@ class SurfaceProcess(multiprocessing.Process): |
133 | 132 | writer.SetInput(polydata) |
134 | 133 | writer.SetFileName(filename) |
135 | 134 | writer.Write() |
136 | - print filename | |
137 | - | |
138 | - time.sleep(1) | |
139 | 135 | |
140 | 136 | self.q_out.put(filename) | ... | ... |