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.
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
Description
As mentioned in this
stack question
, the
documentation about GLCM
shows an example on how to use it with this line of code:
Way to reproduce
from skimage.feature import graycomatrix, graycoprops
which yields an error:
ImportError: cannot import name 'graycomatrix' from 'skimage.feature'
Launching it on binder works. The function linked from the example (
github
and
docs
) both say it with
gray
so I guess there has been some silent update. Could that be fixed/unified?
Version information
# Paste the output of the following python commands
from __future__ import print_function
import sys; print(sys.version)
import platform; print(platform.platform())
import skimage; print(f'scikit-image version: {skimage.__version__}')
import numpy; print(f'numpy version: {numpy.__version__}')
3.8.11 (default, Aug 6 2021, 08:56:27)
[Clang 10.0.0 ]
macOS-10.16-x86_64-i386-64bit
scikit-image version: 0.18.1
numpy version: 1.22.3
Hey
@jankaWIS
, thank you for reaching out and sorry for the late reply.
The function was renamed to
graycomatrix
in
#5385
in order to reduce the confusion between
grey
and
gray
(the latter is prefered now). Your version information indicates that you are using scikit-image 0.18.1 which is before this patch was applied.
Could that be fixed/unified?
What would you like to be fixed or unified? If you want to import the function prior to version 0.19, you'll need to use
greycomatrix
. From 0.19 onwards this feature is deprecated but still "available" till version 1.0.
Hi
@lagru
, thanks for coming back to me. I think that the main reason for raising this issue was the confusion I had. Even now when I started answering I misunderstood how it works. Maybe some red box in docs that for earlier versions it was
grey
? Just to prevent future confusion :).
Thanks
Maybe some red box in docs that for earlier versions it was grey? Just to prevent future confusion :).
@jankaWIS
that's a great idea! Would you like to open a PR, adding the information that
@lagru
described? As in,
If you would like to import the function prior to version 0.19, you need to use
greycomatrix
. From 0.19 onwards, this feature is deprecated.
We can help you in the process.
Thanks again!
Hi
@alexdesiqueira
, sure, I'd be happy to. I looked at the docs, what is your preferred way of doing that? Updating the
docstring of the function
? In that case, do you have a tip for creating a (red) box there? Or do you have a separate place where the documentation sits and where one can update it?
Yes, I think the docstring would be an obvious place to do so. You could add something like
.. versionchanged:: 0.19
`greymatrix` was renamed to `graymatrix` in 0.19.
just before the the Parameters section. The same would be very useful as well for the greycoprops
function. :)
Document refactoring from grey* to graymatrix and graycoprops in 0.19 with versionchanged directive
#6420