You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When measuring region properties on image data that may have negative values (background subtracted), a warning is thrown.
This is because sum(powers) / nu.ndim + 1 can be fractional, and in this specific case mu0 is negative, which attempts computing the root of a negative number.
aeisenbarth
changed the title
moments_weighted_normalized causes Numpy warning "invalid value encountered in double_scalars"
moments_weighted_normalized causes warning "invalid value encountered in double_scalars"
May 14, 2024
Thanks for the report. I can reproduce this. Not sure right now about the best way to handle this because I'm not sure where the actual problem starts.
Does moments_central()[0, 0] being -1. make sense from an interpretation stand point?
I don't know. I don't use moments myself, and this is rather an outlier case.
This happens only with moments_weighted_normalized which receives mu from moments_weighted_central.
When comparing different labels and intensities,
If the normalization term is absolute (… / (np.abs(mu0) ** (sum(powers) / nu.ndim + 1)), it gives identical values for the positive case, and analog values without NaN for the negative case:
Description:
When measuring region properties on image data that may have negative values (background subtracted), a warning is thrown.
This is because
sum(powers) / nu.ndim + 1
can be fractional, and in this specific casemu0
is negative, which attempts computing the root of a negative number.in:
scikit-image/skimage/measure/_moments.py
Line 327 in f5f4b0c
Should users handle (or mute) this warning, or is this something scikit-image should handle (or wrap in an skimage warning)?
Way to reproduce:
Version information:
The text was updated successfully, but these errors were encountered: