Open vpoughon opened 5 years ago
Do you want to update the documentation or make the function consistent (an input bool
should return an output bool
) ?
As we discussed, I advised that in skimage, we try to keep the input and output dtypes identical.
@sciunto Note that, currently, our explicitly stated policy is that we give no guarantees of output types. E.g., when doing interpolation, it would make no sense to stick to integers.
bools are strange datatypes. I would argue that you are likely not getting any benefit from using them as inputs on modern processors, and that this might constitute premature optimization
. My opinion would be to simply use a uint8
with two possible values.
Cython doesn't seem to give a good way to handle boolean objects, possibily because there are no good instructions on modern processors that deal with the boolean
datatype.
We explored how we might incorporate booleans into the workflow, but it doesn't seem like a good idea:
https://github.com/scikit-image/scikit-image/pull/3981#issuecomment-508952914
Honestly, I'm suggesting we bug out on boolean
datatypes, but I understand that is a harsh
reaction.
Nice, well relevant discussion seems to have happened https://github.com/numpy/numpy/issues/9251
But even with some patch from @soupault , I'm still getting
TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead
Has anything changed with that issue? Cause when I was trying to reproduce - I got:
ValueError: dtype cannot be bool.
Also: As I remember bool is actually uint8_t. In many applications have False if value is 0, if any other - True
Description
The documentation of
skimage.filters.rank.maximum
says that the returned array has the same dtype as the input:However this is not the case for
bool
.Way to reproduce
Output:
Tested on skimage
0.14.1
.Related to #466, #1244, #1010