Skip to content

Commit f36abe4

Browse files
authored
Merge branch 'develop' into dev-define-engines-abc
2 parents 56867fc + 5bb255b commit f36abe4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tiatoolbox/utils/misc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ def process_contours(
12601260
12611261
"""
12621262
annotations_list: list[Annotation] = []
1263-
outer_contours: list[np.ndarray] = []
1263+
outer_contours: dict[int, np.ndarray] = {}
12641264
holes_dict: dict[int, list[np.ndarray]] = {}
12651265

12661266
for i, layer_ in enumerate(contours):
@@ -1270,7 +1270,7 @@ def process_contours(
12701270
# save one points as a line, otherwise save the Polygon
12711271
if len(layer_) > 2: # noqa: PLR2004
12721272
if int(hierarchy[0][i][3]) == -1: # Outer contour
1273-
outer_contours.append(scaled_coords[0])
1273+
outer_contours[i] = scaled_coords[0]
12741274
else: # Hole
12751275
parent_idx: int = int(hierarchy[0][i][3])
12761276
if parent_idx not in holes_dict:
@@ -1309,7 +1309,7 @@ def process_contours(
13091309
]
13101310
)
13111311

1312-
for idx, outer in enumerate(outer_contours):
1312+
for idx, outer in outer_contours.items():
13131313
holes: list[np.ndarray] = holes_dict.get(idx, [])
13141314
if len(holes) != 0:
13151315
feature_geom = feature2geometry(

0 commit comments

Comments
 (0)