print("\nVTK version: ", vtk.vtkVersion.GetVTKVersion()) print("VTK: ", vtk, "\n") if args.debug: print("Extracting surface") mesh = vtkutils.extractSurface(vtkimg, isovalue) vtkimg = None gc.collect() if args.debug: print("Cleaning mesh") mesh2 = vtkutils.cleanMesh(mesh, connectivityFilter) mesh = None gc.collect() if args.debug: print("Smoothing mesh", args.smooth, "iterations") mesh3 = vtkutils.smoothMesh(mesh2, args.smooth) mesh2 = None gc.collect() if args.debug: print("Simplifying mesh") mesh4 = vtkutils.reduceMesh(mesh3, args.reduce) mesh3 = None gc.collect() axis_map = {'X': 0, 'Y': 1, 'Z': 2} rotAxis = axis_map[args.rotaxis] if args.rotangle != 0.0: mesh5 = vtkutils.rotateMesh(mesh4, rotAxis, args.rotangle) else: mesh5 = mesh4 vtkutils.writeMesh(mesh5, args.output)
from utils import vtkutils if debug: print("Extracting surface") mesh = vtkutils.extractSurface(vtkimg, isovalue) vtkimg = None gc.collect() if debug: print("Cleaning mesh") mesh2 = vtkutils.cleanMesh(mesh, connectivityFilter) mesh = None gc.collect() if debug: print("Smoothing mesh", smoothIterations, "iterations") mesh3 = vtkutils.smoothMesh(mesh2, smoothIterations) mesh2 = None gc.collect() if debug: print("Simplifying mesh") mesh4 = vtkutils.reduceMesh(mesh3, quad) mesh3 = None gc.collect() if rotFlag: mesh5 = vtkutils.rotateMesh(mesh4, rotAxis, rotAngle) else: mesh5 = mesh4 vtkutils.writeMesh(mesh5, outname) mesh4 = None gc.collect()
def test_smoothMesh(self): print("Testing smoothMesh") result = vtkutils.smoothMesh(TestVTKUtils.BALL) print(result.GetNumberOfPolys())