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

Prevent divide by zero #405

Merged
merged 2 commits into from
Mar 9, 2021
Merged

Prevent divide by zero #405

merged 2 commits into from
Mar 9, 2021

Conversation

ngreenwald
Copy link
Member

If you haven't already, please read through our contributing guidelines before opening your PR

What is the purpose of this PR?
The custom regionprops functions don't do any validation of the inputs. In general this is fine, since they come from the base regionprops function. However, minor_axis_length seems to fairly regularly return a value of zero, which causes errors.

How did you implement your changes

Add error checking and return NaN for division by zero, rather than an error.

Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

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

Looks great. There's no chance the other values will be zero, right?

@ngreenwald
Copy link
Member Author

Yeah, right now it seems like this is the only one

@alex-l-kong alex-l-kong self-requested a review March 5, 2021 23:53
Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

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

👍

@ngreenwald ngreenwald merged commit 2b67571 into master Mar 9, 2021
@ngreenwald ngreenwald deleted the regionprops_sanitization branch March 9, 2021 20:00
y2kbugger pushed a commit that referenced this pull request Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants