-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: Add multiple otsu as threshold method with selection range of components (Sourcery refactored) #713
feat: Add multiple otsu as threshold method with selection range of components (Sourcery refactored) #713
Conversation
def calculate_property(area_array: np.ndarray, channel: np.ndarray, **_): # pylint: disable=W0221 | ||
def calculate_property(area_array: np.ndarray, channel: np.ndarray, **_): # pylint: disable=W0221 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function PixelBrightnessSum.calculate_property
refactored with the following changes:
- Swap positions of nested conditionals (
swap-nested-ifs
) - Hoist nested repeated code outside conditional statements (
hoist-similar-statement-from-if
) - Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
This removes the following comments ( why? ):
# pragma: no cover
if np.any(area_array): | ||
return np.max(channel[area_array > 0]) | ||
return 0 | ||
return np.max(channel[area_array > 0]) if np.any(area_array) else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function MaximumPixelBrightness.calculate_property
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if np.any(area_array): | ||
return np.min(channel[area_array > 0]) | ||
return 0 | ||
return np.min(channel[area_array > 0]) if np.any(area_array) else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function MinimumPixelBrightness.calculate_property
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if np.any(area_array): | ||
return np.mean(channel[area_array > 0]) | ||
return 0 | ||
return np.mean(channel[area_array > 0]) if np.any(area_array) else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function MeanPixelBrightness.calculate_property
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if np.any(area_array): | ||
return np.median(channel[area_array > 0]) | ||
return 0 | ||
return np.median(channel[area_array > 0]) if np.any(area_array) else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function MedianPixelBrightness.calculate_property
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if np.any(area_array): | ||
return np.std(channel[area_array > 0]) | ||
return 0 | ||
return np.std(channel[area_array > 0]) if np.any(area_array) else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function StandardDeviationOfPixelBrightness.calculate_property
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if np.any(final_mask): | ||
return np.sum(channel[final_mask]) | ||
return 0 | ||
return np.sum(channel[final_mask]) if np.any(final_mask) else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function RimPixelBrightnessSum.calculate_property
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.16%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Preview page for your plugin is ready here: |
Codecov ReportBase: 88.76% // Head: 88.75% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## feature/multipe_otsu_components #713 +/- ##
===================================================================
- Coverage 88.76% 88.75% -0.01%
===================================================================
Files 190 190
Lines 29349 29335 -14
===================================================================
- Hits 26051 26037 -14
Misses 3298 3298
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Pull Request #710 refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
feature/multipe_otsu_components
branch, then run:Help us improve this pull request!