Skip to content

Commit

Permalink
Implement notification to inform the user when predictions for the ne…
Browse files Browse the repository at this point in the history
…xt 60 frames are complete.
  • Loading branch information
healthonrails committed Jan 10, 2024
1 parent 0d148e5 commit 813f18b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions annolid/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

class FlexibleWorker(QtCore.QObject):
start = QtCore.Signal()
finished = QtCore.Signal()

def __init__(self, function, *args, **kwargs):
super(FlexibleWorker, self).__init__()
Expand All @@ -77,6 +78,7 @@ def __init__(self, function, *args, **kwargs):

def run(self):
self.function(*self.args, **self.kwargs)
self.finished.emit()


class LoadFrameThread(QtCore.QObject):
Expand Down Expand Up @@ -863,6 +865,11 @@ def _saveImageFile(self, filename):
imgviz.io.imsave(image_filename, img)
return image_filename

def predict_is_ready(self):
QtWidgets.QMessageBox.information(
self, "Prediction Ready",
"Predictions for the next 60 video frames have been generated!")

def saveLabels(self, filename):
lf = LabelFile()

Expand Down Expand Up @@ -921,6 +928,10 @@ def format_shape(s):
)
self.pred_worker.moveToThread(self.seg_pred_thread)
self.pred_worker.start.connect(self.pred_worker.run)
self.seg_pred_thread.started.connect(self.pred_worker.start)
self.pred_worker.finished.connect(self.predict_is_ready)
self.seg_pred_thread.finished.connect(
self.seg_pred_thread.quit)
self.pred_worker.start.emit()

self.labelFile = lf
Expand Down

0 comments on commit 813f18b

Please sign in to comment.