Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

Fixed skimage.feature.graycomatrix example documentation. #7297

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

FedericoWZhaw
Copy link

Fixed documentation according to #7293

@soupault soupault added the 📄 type: Documentation Updates, fixes and additions to documentation label Jan 16, 2024
Copy link
Member

@soupault soupault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mkcor
Copy link
Member

mkcor commented Jan 17, 2024

Thank you, @FedericoWZhaw! May I ask that you wrap the line at 88 characters? I'm actually surprised that pre-commit passed...

args: [--no-pycodestyle, --max-line-length=88]

@FedericoWZhaw
Copy link
Author

Thank you, @FedericoWZhaw! May I ask that you wrap the line at 88 characters? I'm actually surprised that pre-commit passed...

args: [--no-pycodestyle, --max-line-length=88]

Done

Compute 2 GLCMs: One for a 1-pixel offset to the right, and one
for a 1-pixel offset upwards.
Compute 4 GLCMs at 1-pixel offset for 4 different angles. For example, 0 radians
refers to the pixel to the right and pi/2 to the pixel above.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @FedericoWZhaw! I would be a little more explicit; maybe:

Compute 4 GLCMs: The first one for a 1-pixel offset to the right (distance 1 and angle 0 rad); the second one for a 1-pixel offset to the first bisector (distance 1 and angle pi/4); etc.

or include it as comments in the code, when each GLCM is printed. Is it correct that pi/4 and 3*pi/4 correspond to the upward diagonal directions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"1-pixel offset" and "distance 1" seem somewhat redundant, I find the later more precise? "bisector" seems like a very technical term that's not used anywhere else in the docstring..?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"1-pixel offset" and "distance 1" seem somewhat redundant, I find the later more precise?

The description of the distance parameter states:
distances : array_like
List of pixel pair distance offsets.

What about:
"Compute 4 GLCMs using 1-pixel distance and 4 different angles. For example, an angle of 0 radians refers to the neighboring pixel to the right; pi/4 to the top-right diagonal neighbor (row-1,column+1); pi/2 to the pixel above, etc."

Feel free to suggest something else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both for iterating! 😃

"1-pixel offset" and "distance 1" seem somewhat redundant

Totally, but that was on purpose, to clarify the arguments, as done in the text of the gallery example: "a 1-pixel offset to the right (distance 1 and angle 0 rad)" parallels "a horizontal offset of 5 (distance=[5] and angles=[0])."

"bisector" seems like a very technical term

I must say I'm not sure how it sound to most ears... I would assume that someone using scikit-image would have some minimal computing background and, for instance, would have already heard something like "the equation of the first bisector line is y=x" (but I'm definitely not attached to this term).

I very much like @FedericoWZhaw's suggestion (minor: I would write "0 radian" instead of "0 radians"). It's just that -- and that was my original motivation for suggesting a change -- an angle refers to a direction so, e.g., an angle of 0 refers to all pixels to the right, not only to the pixel to the right; the fact that it's the pixel to the right comes from the pair (distance=1, angle=0); same with all other angles (angle pi/2 means one of the pixels straight above, and it's the pixel right above because it's at distance 1).

@mkcor
Copy link
Member

mkcor commented Feb 1, 2024

@FedericoWZhaw are you able to wrap this up? Or would you like us to take over and co-author a third/final commit? Thanks!

@FedericoWZhaw
Copy link
Author

@FedericoWZhaw are you able to wrap this up? Or would you like us to take over and co-author a third/final commit? Thanks!

Thanks for the inputs and the interesting discussion! Since it is not fully clear to me if we want to go for a variant of :

"Compute 4 GLCMs using 1-pixel distance and 4 different angles. For example, an angle of 0 radians refers to the neighboring pixel to the right; pi/4 to the top-right diagonal neighbor (row-1,column+1); pi/2 to the pixel above, etc."

or

"Compute 4 GLCMs: The first one for a 1-pixel offset to the right (distance 1 and angle 0 rad); the second one for a 1-pixel offset to the first bisector (distance 1 and angle pi/4); etc."

I think it's best you take over the final commit, that should be the fastest solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📄 type: Documentation Updates, fixes and additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants