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

Minor fixes to segmentation #195

Merged
merged 2 commits into from
Aug 15, 2022
Merged

Minor fixes to segmentation #195

merged 2 commits into from
Aug 15, 2022

Conversation

CPBridge
Copy link
Collaborator

As I was reviewing #184 I noticed some minor errors in the implementation of segmentation. Just some checks that are redundant and make the code more confusing to follow as well as the typo you found in the examples. I thought I might as well push these now

@hackermd

@CPBridge CPBridge requested a review from hackermd August 14, 2022 22:56
Comment on lines -576 to -580
if pixel_array.shape[1:3] != (self.Rows, self.Columns):
raise ValueError(
'Pixel array representing segments has the wrong number of '
'rows and columns.'
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is true by construction of the self.Rows and self.Columns, so the check is pointless

Comment on lines -571 to -572
if pixel_array.ndim == 2:
pixel_array = pixel_array[np.newaxis, ...]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is duplicated from above

Comment on lines -573 to -574
if pixel_array.ndim not in [3, 4]:
raise ValueError('Pixel array must be a 2D, 3D, or 4D array.')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moving this earlier simplifies things a bit

@hackermd hackermd merged commit ed5901f into master Aug 15, 2022
@hackermd hackermd deleted the bug/seg_fixes branch August 15, 2022 01:02
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.

2 participants