loli / medpy

Medical image processing in Python
http://loli.github.io/medpy/
GNU General Public License v3.0
558 stars 136 forks source link

Numpy.bool is deprecated #116

Closed captainjtx closed 7 months ago

captainjtx commented 10 months ago

Numpy deprecated numpy.bool in favor of python bool since 2021. Which MedPy still uses, for example https://github.com/loli/medpy/blob/66265de8aedf6259feac00b897a22d0cf173d2e2/medpy/features/texture.py#L74.

Seems straightforward to fix. Let me know if I can help.

Another question, when can be have another release cut ? The last one is already 4 years ago :)

harshamarupudi56 commented 8 months ago

I had this issue as well when using metrics such as dice and jaccard. Had to write my own functions to address this. Just have to replace np.bool with bool.

loli commented 8 months ago

Hey, thanks for the feedback!

I'll try to squeeze in another release till the end of the year - quite a lot of work, though. Can't promise anything, unfortunately.

If any of you would be willing to make a PR out of your fixes for this depreciation warning, I would include it. Thanks!

harshamarupudi56 commented 8 months ago

I wrote my own function for dice and jaccard calculation rather than what you had in the binary folder. Your code should work if you swap np.bool with bool. I can share my functions if you are interested however.

StellarStorm commented 8 months ago

@loli PR #113 should address this! I mapped numpy.float -> float, numpy.int -> int, and numpy.bool -> numpy.bool_. Specific precision types like numpy.float32 were not changed as these aren't deprecated and I didn't want to change any behavior inadvertently. Similarly I used numpy.bool_ instead of bool to keep things in numpy as much as possible - this probably wouldn't make a difference but better to be safe.

StellarStorm commented 7 months ago

@loli would you be open to adding additional maintainers to the project? I feel we could get through the open PRs and a lot of the issues decently quickly.

loli commented 7 months ago

Indeed, another helping hand would be very welcome. Tanks for the offer, I've dropped you an invite.

StellarStorm commented 7 months ago

@captainjtx thank you for the report! This should be fixed in #113 Until a new release is out, you can install the latest version with pip install git+https://github.com/loli/medpy.git