From 47b3afe89df2fe44506bf3b080ecd099bc17c88d Mon Sep 17 00:00:00 2001 From: healthonrails Date: Thu, 17 Oct 2024 13:53:20 -0400 Subject: [PATCH] Add check for caption existence to ensure backward compatibility with label files. --- annolid/gui/app.py | 3 ++- annolid/gui/label_file.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/annolid/gui/app.py b/annolid/gui/app.py index 56285be..6c90eee 100644 --- a/annolid/gui/app.py +++ b/annolid/gui/app.py @@ -2323,7 +2323,8 @@ def loadPredictShapes(self, frame_number, filename): if self.labelFile: self.loadLabels(self.labelFile.shapes) caption = self.labelFile.get_caption() - self.canvas.setCaption(caption) + if caption is not None: + self.canvas.setCaption(caption) except Exception as e: print(e) diff --git a/annolid/gui/label_file.py b/annolid/gui/label_file.py index ed78c59..adef63b 100644 --- a/annolid/gui/label_file.py +++ b/annolid/gui/label_file.py @@ -97,7 +97,7 @@ def load(self, filename): imagePath = None caption = None - if data['caption'] is not None: + if 'caption' in data and data['caption'] is not None: caption = data['caption'] if data["imageData"] is not None: