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

fix: numpy 2.0 compatybility (array.max() dtype problem) #150

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

Czaki
Copy link
Contributor

@Czaki Czaki commented Jul 16, 2024

I found in my tests that since numpy 2.0 the data.max() returns the same dtype as array data.
So for array of type np.uint8 and max value 255 it leads to create cmat of size 0, 0.

This PR converts size to int before increasing it by 1.

@luispedro
Copy link
Owner

Thanks! And really I appreciate that you added a test too!

@luispedro luispedro merged commit f91e0c8 into luispedro:main Jul 16, 2024
6 checks passed
@Czaki Czaki deleted the fix_size_calculation branch July 16, 2024 14:52
Czaki added a commit to 4DNucleome/PartSeg that referenced this pull request Jul 16, 2024
…lem (#1150)

Workaround for luispedro/mahotas#150

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Improved image rescaling logic to enhance visual representation
accuracy.

- **Tests**
- Reordered test items for better organization and efficiency based on
file paths.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
luispedro added a commit that referenced this pull request Jul 17, 2024
- Fix bug in Haralick features and NumPy 2 (thanks to @Czaki, see [#150](#150))
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