Skip to content

add large image support to cucim.skimage.measure.label (support 64-bit indexing)#1087

Open
grlee77 wants to merge 1 commit into
rapidsai:mainfrom
grlee77:grelee/measure-label-large-size-fix
Open

add large image support to cucim.skimage.measure.label (support 64-bit indexing)#1087
grlee77 wants to merge 1 commit into
rapidsai:mainfrom
grlee77:grelee/measure-label-large-size-fix

Conversation

@grlee77
Copy link
Copy Markdown
Contributor

@grlee77 grlee77 commented May 22, 2026

closes #1076

CuPy recently updated cupyx.scipy.ndimage.label to support 64-bit indexing when necessary to support large image sizes. See a more detailed description for the changes made in the upstream PR:
cupy/cupy#9859

This MR makes the exact same change to the very similar kernels underlying cucim.skimage.measure.label. The reason we don't use CuPy kernels directly for cuCIM's label is that the CuPy API is for binary image labeling only (i.e. all foreground pixels are treated the same regardless of intensity). The version of label in the scikit-image API also supports a grayscale mode where neighboring pixels are only connected if the grayscale intensity is actually equal. Thus we have modified kernels that support that logic. The indexing concern and solution is the same as in the upstream PR, though.

64-bit indexing and label array is used instead of 32-bit when necessary
@grlee77 grlee77 added this to the v26.08 milestone May 22, 2026
@grlee77 grlee77 requested a review from a team as a code owner May 22, 2026 15:21
@grlee77 grlee77 added this to cucim May 22, 2026
@grlee77 grlee77 added bug Something isn't working non-breaking Introduces a non-breaking change labels May 22, 2026
Copy link
Copy Markdown
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Greg! 🙏

Generally looks reasonable

Had a couple minor questions on cleanups


import cupy as cp

# import numpy as np
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing we just never needed NumPy here

Comment on lines 18 to 20
# import pytest

# import cucim.skimage.measure._ccomp as ccomp
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop these too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[FEA] adopt ndimage.label large array support from CuPy

2 participants