-
Notifications
You must be signed in to change notification settings - Fork 7
Fix quickshear edge detection wrap-around issue by using convolution #170
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
base: main
Are you sure you want to change the base?
Fix quickshear edge detection wrap-around issue by using convolution #170
Conversation
|
Please also see #167 (comment) |
|
@uturkbey thanks! Please try to fix the failing tests. Unfortunately, you cannot use our brainless bot for black formatting because the PR does not belong to the repo. |
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.
Pull request overview
This pull request fixes a critical bug in the Quickshear defacing algorithm where edge detection produced incorrect results when brain masks touch array boundaries. The issue was caused by np.roll operations creating artificial wrap-around edges on opposite boundaries.
Changes:
- Replaced
np.roll-based edge detection withscipy.ndimage.convolveusing a 4-neighborhood Laplacian kernel - Added import for
convolvefromscipy.ndimage - Applied
mode='constant', cval=0.0to prevent boundary wrap-around
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
For sure, writing you an email! |
Bug fix for the edge detection wrap-around issue mentioned in #167:
np.rolloperations are changed toscipy.ndimage.convolvewith a 4-neighborhood Laplacian edge detection kernel.np.padbeforenp.roll). Summarized results are as below.