File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1157,8 +1157,10 @@ def largest_k(
11571157 """
11581158 assert k >= 0
11591159
1160+ order = "C" if img.flags.c_contiguous else "F"
1161+
11601162 if k == 0:
1161- return np.zeros(img.shape, dtype=np.uint16)
1163+ return np.zeros(img.shape, dtype=np.uint16, order=order )
11621164
11631165 cc_labels, N = connected_components(
11641166 img, connectivity=connectivity,
@@ -1176,9 +1178,11 @@ def largest_k(
11761178
11771179 shape, dtype = cc_labels.shape, cc_labels.dtype
11781180 rns = runs(cc_labels)
1179- del cc_labels
11801181
1181- cc_out = np.zeros(shape, dtype=dtype)
1182+ order = "C" if cc_labels.flags.c_contiguous else "F"
1183+ del cc_labels
1184+
1185+ cc_out = np.zeros(shape, dtype=dtype, order=order)
11821186 for i, label in enumerate(preserve):
11831187 draw(i+1, rns[label], cc_out)
11841188
You can’t perform that action at this time.
0 commit comments