Skip to content

Commit 422ab5d

Browse files
Merge pull request #1123 from mese79/main
fixed "RuntimeError: structure and input must have equal rank"
2 parents 3f13617 + 5366069 commit 422ab5d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cellpose/contrib/distributed_segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,13 +866,13 @@ def block_face_adjacency_graph(faces, nlabels):
866866
# print("Final nlabels:", nlabels, "Type:", type(nlabels))
867867

868868
all_mappings = []
869-
structure = scipy.ndimage.generate_binary_structure(3, 1)
870869
for face in faces:
871870
sl0 = tuple(slice(0, 1) if d==2 else slice(None) for d in face.shape)
872871
sl1 = tuple(slice(1, 2) if d==2 else slice(None) for d in face.shape)
873872
a = shrink_labels(face[sl0], 1.0)
874873
b = shrink_labels(face[sl1], 1.0)
875874
face = np.concatenate((a, b), axis=np.argmin(a.shape))
875+
structure = scipy.ndimage.generate_binary_structure(face.ndim, 1)
876876
mapped = dask_image.ndmeasure._utils._label._across_block_label_grouping(face, structure)
877877
all_mappings.append(mapped)
878878
i, j = np.concatenate(all_mappings, axis=1)

0 commit comments

Comments
 (0)