Skip to content

Conversation

@mese79
Copy link

@mese79 mese79 commented Mar 6, 2025

In block_face_adjacency_graph function of distributed_segmentation the assumption for the face dimensions is 3D while it will raise an error if you pass 2D input (blocks).

File /miniforge3/envs/cellpose/lib/python3.10/site-packages/scipy/ndimage/_measurements.py:182, in label(input, structure, output)
    180 structure = np.asarray(structure, dtype=bool)
    181 if structure.ndim != input.ndim:
--> 182     raise RuntimeError('structure and input must have equal rank')

I update the code so the structure will have the same rank as the face (here):

structure = scipy.ndimage.generate_binary_structure(face.ndim, 1)

@carsen-stringer
Copy link
Member

thanks, cc @GFleishman

lguerard added a commit to lguerard/cellpose that referenced this pull request Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants