Commit 5e0c04d2840332d9d2d850f99bfae4e38b645a60

Authored by tfmoraes
1 parent bb9de130

FIX: separation of pieces to surface_process wasn't working in mac

Showing 1 changed file with 8 additions and 11 deletions   Show diff stats
invesalius/data/surface.py
@@ -447,13 +447,13 @@ class SurfaceManager(): @@ -447,13 +447,13 @@ class SurfaceManager():
447 else: 447 else:
448 flip_image = True 448 flip_image = True
449 449
450 - n_processors = 1 # multiprocessing.cpu_count() 450 + n_processors = multiprocessing.cpu_count()
451 451
452 pipe_in, pipe_out = multiprocessing.Pipe() 452 pipe_in, pipe_out = multiprocessing.Pipe()
453 - o_piece = 2 453 + o_piece = 1
454 piece_size = 40 454 piece_size = 40
455 455
456 - n_pieces = round(mask.matrix.shape[0] / piece_size + 0.5, 0) 456 + n_pieces = int(round(mask.matrix.shape[0] / piece_size + 0.5, 0))
457 print "n_pieces", n_pieces, mask.matrix.shape 457 print "n_pieces", n_pieces, mask.matrix.shape
458 458
459 q_in = multiprocessing.Queue() 459 q_in = multiprocessing.Queue()
@@ -494,16 +494,13 @@ class SurfaceManager(): @@ -494,16 +494,13 @@ class SurfaceManager():
494 494
495 polydata = polydata_append.GetOutput() 495 polydata = polydata_append.GetOutput()
496 496
497 - # Orient normals from inside to outside  
498 - normals = vtk.vtkPolyDataNormals()  
499 - normals.SetInput(polydata)  
500 - normals.SetFeatureAngle(80)  
501 - normals.AutoOrientNormalsOn()  
502 - normals.GetOutput().ReleaseDataFlagOn() 497 + clean = vtk.vtkCleanPolyData()
  498 + clean.SetInput(polydata)
  499 + clean.PointMergingOn()
503 500
504 - # Improve performance 501 + # Improve performance
505 stripper = vtk.vtkStripper() 502 stripper = vtk.vtkStripper()
506 - stripper.SetInput(normals.GetOutput()) 503 + stripper.SetInput(clean.GetOutput())
507 stripper.PassThroughCellIdsOn() 504 stripper.PassThroughCellIdsOn()
508 stripper.PassThroughPointIdsOn() 505 stripper.PassThroughPointIdsOn()
509 506