Skip to content

Commit 3087d03

Browse files
Merge pull request #59 from computational-cell-analytics/fix-track
Fix issue in tracking annotator
2 parents 5e63ed4 + c82d344 commit 3087d03

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

micro_sam/sam_annotator/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def prompt_layer_to_boxes(prompt_layer, i=None, track_id=None):
110110
shape_data = prompt_layer.data
111111
shape_types = prompt_layer.shape_type
112112
assert len(shape_data) == len(shape_types)
113+
if len(shape_data) == 0:
114+
return []
113115

114116
if i is None:
115117
# select all boxes that are rectangles
@@ -131,7 +133,7 @@ def prompt_layer_to_boxes(prompt_layer, i=None, track_id=None):
131133
]
132134
else:
133135
track_ids = np.array(list(map(int, prompt_layer.properties["track_id"])))
134-
assert len(track_ids) == len(shape_data)
136+
assert len(track_ids) == len(shape_data), f"{len(track_ids)}, {len(shape_data)}"
135137
boxes = [
136138
data[:, 1:] for data, stype, this_track_id in zip(shape_data, shape_types, track_ids)
137139
if (stype == "rectangle" and (data[:, 0] == i).all() and this_track_id == track_id)

0 commit comments

Comments
 (0)