Skip to content

WarpTransform: reflection padding to remove edge striping at warped-axis faces#1025

Open
pscamillo wants to merge 1 commit into
ScrollPrize:mainfrom
pscamillo:fix-warp-edge-padding
Open

WarpTransform: reflection padding to remove edge striping at warped-axis faces#1025
pscamillo wants to merge 1 commit into
ScrollPrize:mainfrom
pscamillo:fix-warp-edge-padding

Conversation

@pscamillo

Copy link
Copy Markdown
Contributor

Follow-up to the scroll-specific Warp augmentation (merged in #999, issue #201).

While validating WarpTransform on a real Scroll 5 CT crop, I found a thin striped band along the warped-axis end-faces. Root cause: the coherent displacement is constant along the normal axis (by design — the stacked sheets bend together as a unit), so at the two end-faces the shift pushes the sampling grid off-volume. With padding_mode="border", those out-of-bounds samples clamp to the single edge value; since the displacement varies in-plane, adjacent columns clamp by different amounts, leaving a striped band at the face.

Fix: switch the grid_sample in _warp from padding_mode="border" to "reflection". Out-of-bounds samples now mirror interior texture instead of replicating the edge value, so the band disappears. The displacement field is untouched, so the coherent (constant-along-normal) bend and the strictly-monotonic / no-fold guarantee are preserved. One-line change.

Validation on a real Scroll 5 crop (1, 48, 512, 512), with the normal axis forced to an in-plane axis so the face is visible in the viewed plane:

  • before (border): striped band at the warped-axis face
  • after (reflection): face is clean; interior warp unchanged

The __main__ self-test still passes (identity when disabled, shape preserved, finite values, labels a subset, coherent bend).
warp_before
warp_after

@pscamillo pscamillo requested a review from giorgioangel as a code owner June 8, 2026 14:41
@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

@pscamillo is attempting to deploy a commit to the scroll Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant