Hi
While reading my DICOM series I want to send a message to the server notifying the current progress of the reading. I found out that there is the .addObserver() method which allows to register some events of a vtkObject. The problem is: I need to send this through a python websocket which uses the async/await notation. This is a snippet of my code
...
reader = vtk.vtkDICOMReader()
reader.SetFileNames(filenames)
progress_event = ProgressEvent(websocket)
reader.AddObserver("ProgressEvent", progress_event)
...
class ProgressEvent:
def __init__(self, websocket):
self.websocket = websocket
def __call__(self, caller, event):
self.websocket.send('{"type": "progress", "amount": %s}' % caller.GetProgress())
This code does not work since it does not implement the async/await syntax. Setting it make so that the code inside the call function is not called.
Do you have any suggestion? Maybe there is another way to get a costant progress to send in some other way?
Thanks