Skip to content
New issue

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

crop fails for np.int64 #5418

Closed
ianhi opened this issue Jun 8, 2021 · 0 comments · Fixed by #5419
Closed

crop fails for np.int64 #5418

ianhi opened this issue Jun 8, 2021 · 0 comments · Fixed by #5419

Comments

@ianhi
Copy link
Contributor

ianhi commented Jun 8, 2021

Description

skimage.util.crop fails when passed a numpy integer object. See numpy/numpy#2951 for discussion as to why. I believe the fix is to check for numbers.Integral (I'll send PR)

Way to reproduce

import numpy as np
from skimage.util import crop
image = np.arange(100).reshape(10,10)

# this works
crop(image, 2)

# this breaks
crop(image, np.int64(2))


# this comes up when doing something like
for crop_factor in np.arange(2,10):
    tmp = crop(image, crop_factor)
    # do something

Version information

# Paste the output of the following python commands
from __future__ import print_function
import sys; print(sys.version)
import platform; print(platform.platform())
import skimage; print("scikit-image version: {}".format(skimage.__version__))
import numpy; print("numpy version: {}".format(numpy.__version__))
3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0]
Linux-5.8.0-7642-generic-x86_64-with-glibc2.10
scikit-image version: 0.18.1
numpy version: 1.20.3
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 a pull request may close this issue.

2 participants