We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
join_segmentations
np.uint
When input arrays are created with np.uint, operations between different integer dtypes change behavior and produce a float, causing an error.
This is because factor = s2.max() + 1 is [uint64]+[int]→[float64].
factor = s2.max() + 1
>>> import numpy as np >>> from skimage.segmentation import join_segmentations >>> s1 = np.array([[0, 0], [1, 1]], dtype=np.uint) >>> s2 = np.array([[0, 1], [0, 1]], dtype=np.uint) >>> s1.dtype dtype('uint64') >>> s12 = join_segmentations(s1, s2) Traceback (most recent call last): File "…/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-129-041632ba5934>", line 1, in <module> s12 = join_segmentations(s1, s2) File "…/site-packages/skimage/segmentation/_join.py", line 59, in join_segmentations j, _, map_j_to_j_initial = relabel_sequential(j_initial) File "…/site-packages/skimage/segmentation/_join.py", line 156, in relabel_sequential raise TypeError("label_field must have an integer dtype") TypeError: label_field must have an integer dtype
3.9.17 (main, Jul 5 2023, 21:05:34) [GCC 11.2.0] Linux-5.15.0-91-generic-x86_64-with-glibc2.35 scikit-image version: 0.22.0 numpy version: 1.23.4
The text was updated successfully, but these errors were encountered:
Add test case for join_segmentations dtype error (scikit-image#7291)
3af50e2
Fix uint64 + 1 changing to float (scikit-image#7291)
3fc8b06
Successfully merging a pull request may close this issue.
Description:
When input arrays are created with
np.uint
, operations between different integer dtypes change behavior and produce a float, causing an error.This is because
factor = s2.max() + 1
is [uint64]+[int]→[float64].Way to reproduce:
Version information:
The text was updated successfully, but these errors were encountered: