Commit 38a8a71bcb8e2fd738ab47bce6b7651e52bd8072

Authored by Paulo Henrique Junqueira Amorim
1 parent e63af012

ENH: Improved little better progress bar

Showing 1 changed file with 12 additions and 10 deletions   Show diff stats
invesalius/data/surface.py
... ... @@ -377,7 +377,7 @@ class SurfaceManager():
377 377 """
378 378 matrix, filename_img, mask, spacing = pubsub_evt.data
379 379 min_value, max_value = mask.threshold_range
380   - fill_holes = False
  380 + fill_holes = True
381 381  
382 382 #if len(surface_data) == 5:
383 383 #imagedata, colour, [min_value, max_value], \
... ... @@ -394,7 +394,7 @@ class SurfaceManager():
394 394  
395 395 mode = 'CONTOUR' # 'GRAYSCALE'
396 396 quality=_('Optimal *')
397   - keep_largest = False
  397 + keep_largest = True
398 398 surface_name = ""
399 399 colour = mask.colour
400 400  
... ... @@ -420,10 +420,10 @@ class SurfaceManager():
420 420 pipeline_size += 1
421 421 if (smooth_iterations and smooth_relaxation_factor):
422 422 pipeline_size += 1
423   - #if fill_holes:
424   - # pipeline_size += 1
425   - #if keep_largest:
426   - # pipeline_size += 1
  423 + if fill_holes:
  424 + pipeline_size += 1
  425 + if keep_largest:
  426 + pipeline_size += 1
427 427  
428 428 ## Update progress value in GUI
429 429 UpdateProgress = vu.ShowProgress(pipeline_size)
... ... @@ -539,8 +539,8 @@ class SurfaceManager():
539 539 filled_polydata = vtk.vtkFillHolesFilter()
540 540 filled_polydata.SetInput(polydata)
541 541 filled_polydata.SetHoleSize(300)
542   - #filled_polydata.AddObserver("ProgressEvent", lambda obj,evt:
543   - # UpdateProgress(obj, _("Generating 3D surface...")))
  542 + filled_polydata.AddObserver("ProgressEvent", lambda obj,evt:
  543 + UpdateProgress(obj, _("Generating 3D surface...")))
544 544 polydata = filled_polydata.GetOutput()
545 545  
546 546 normals = vtk.vtkPolyDataNormals()
... ... @@ -640,11 +640,13 @@ class SurfaceManager():
640 640 surface.colour, surface.volume,
641 641 surface.transparency))
642 642  
643   - UpdateProgress(0, _("Ready"))
  643 +
  644 + #When you finalize the progress. The bar is cleaned.
  645 + UpdateProgress = vu.ShowProgress(1)
644 646 UpdateProgress(0, _("Ready"))
645 647 ps.Publisher().sendMessage('Update status text in GUI',
646 648 _("Ready"))
647   -
  649 +
648 650 ps.Publisher().sendMessage('End busy cursor')
649 651  
650 652  
... ...