loli / medpy

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

Update binary.py #123

Closed ChekrounMohammed closed 5 months ago

ChekrounMohammed commented 5 months ago

numpy.bool is deprecated in version 1.20.0 (https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations)

StellarStorm commented 5 months ago

Hi @ChekrounMohammed thanks for the PR! If I'm reading it correctly, this is replacing np.bool_ (note the trailing underscore) with bool. As best as I understand, np.bool_ has not been deprecated, although np.bool (no underscore) was removed in Numpy 1.24.

We added in np.bool_ as a replacement for np.bool in 3955fe274904ce5789a3c349c63ac16e2af4c3b1. This was done to preserve the same implementation details under the hood and avoid any surprises (side note: I'm pretty sure bool, as you've done here, would still perform the same! But np.bool_ is the safe choice). So to be safe, I believe np.bool_ should be kept.

I'll close this for now, but thank you for the contribution - and if you are seeing issues with np.bool_, please feel free to comment back here!