diff --git a/annolid/gui/app.py b/annolid/gui/app.py index ce58a32..5f51835 100644 --- a/annolid/gui/app.py +++ b/annolid/gui/app.py @@ -7,6 +7,7 @@ import html import shutil import pandas as pd +import numpy as np from collections import deque import torch import codecs @@ -1218,7 +1219,7 @@ def saveLabels(self, filename): def format_shape(s): data = s.other_data.copy() - if 'zone' in s.description.lower(): + if s.description and 'zone' in s.description.lower(): has_zone_shapes = True if len(s.points) <= 1: s.shape_type = 'point' @@ -1231,7 +1232,7 @@ def format_shape(s): flags=s.flags, mask=None if s.mask is None - else utils.img_arr_to_b64(s.mask), + else utils.img_arr_to_b64(s.mask.astype(np.uint8)), visible=s.visible, description=s.description ) diff --git a/annolid/gui/label_file.py b/annolid/gui/label_file.py index 6e45e4f..0f75494 100644 --- a/annolid/gui/label_file.py +++ b/annolid/gui/label_file.py @@ -120,7 +120,7 @@ def load(self, filename): description=s.get("description"), group_id=s.get("group_id"), mask=utils.img_b64_to_arr( - s["mask"]) if s.get("mask") else None, + s["mask"]).astype(bool) if s.get("mask") else None, visible=s.get("visible"), other_data={k: v for k, v in s.items() if k not in shape_keys},