Fix quickshear edge detection wrap-around issue by using convolution#170
Fix quickshear edge detection wrap-around issue by using convolution#170uturkbey wants to merge 4 commits intoBrainLesion:mainfrom
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.
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.