From c71d853eead1810fe69d1b0325b6da0fddc61253 Mon Sep 17 00:00:00 2001 From: Vaishnavi Bhandari Date: Thu, 23 Jan 2025 13:59:34 +0530 Subject: [PATCH] Volume rendering progress bar replaced with wx.ProgressDialog Signed-off-by: Vaishnavi Bhandari --- invesalius/data/volume_widgets.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/invesalius/data/volume_widgets.py b/invesalius/data/volume_widgets.py index 00d951df3..4a2d632bd 100644 --- a/invesalius/data/volume_widgets.py +++ b/invesalius/data/volume_widgets.py @@ -20,7 +20,9 @@ from vtkmodules.vtkFiltersSources import vtkPlaneSource from vtkmodules.vtkInteractionWidgets import vtkImagePlaneWidget from vtkmodules.vtkRenderingCore import vtkActor, vtkCellPicker, vtkPolyDataMapper - +from gui.dialogs import ProgressBarHandler +import time +from wx.lib.pubsub import Publisher AXIAL, SAGITAL, CORONAL = 0, 1, 2 PLANE_DATA = {AXIAL: ["z", (0, 0, 1)], SAGITAL: ["x", (1, 0, 0)], CORONAL: ["y", (0, 1, 0)]} @@ -80,6 +82,12 @@ def SetInput(self, imagedata): # permute.GetOutput().ReleaseDataFlagOn() # permute.SetOutputSpacing(spacing, spacing, spacing) # imagedata = permute.GetOutput() + progress_dialog = ProgressBarHandler(self.iren.GetParent(), title="Loading Image Data", msg="Processing...", max_value=100) + for i in range(101): + time.sleep(0.05) + Publisher.sendMessage("Update Progress bar", i, f"Loading slice {i}...") + if progress_dialog.was_cancelled(): + break # Picker for enabling plane motion. # Allows selection of a cell by shooting a ray into graphics window @@ -124,6 +132,8 @@ def SetInput(self, imagedata): self.render.AddActor(actor) + + def Update(self, x=None, y=None): source = self.source widget = self.widget