Skip to content

Reject non-positive patch stride in WSIPatcher - #253

Open
VishalJ99 wants to merge 1 commit into
mahmoodlab:mainfrom
VishalJ99:fix-zero-stride-hang
Open

VishalJ99 wants to merge 1 commit into
mahmoodlab:mainfrom
VishalJ99:fix-zero-stride-hang

Conversation

@VishalJ99

Copy link
Copy Markdown
Contributor

Patching with --overlap >= --patch_size after rounding to level-0 pixels produced a zero or negative stride and looped forever with no error (including edge cases like patch_size=256, overlap=255 when upsampling 20x to 40x, where both round to 128).

Changes

  • trident/wsi_objects/WSIPatcher.py: compute step = self.patch_size_src - self.overlap_src before building a new grid (custom_coords is None) and raise a ValueError telling the user to reduce overlap or increase patch_size when step <= 0.
  • tests/test_patcher_scan_order.py: add a fast synthetic test covering a rounded zero stride on a new grid and confirming custom_coords is unaffected.
  • .claude/skills/trident/SKILL.md, .claude/skills/trident/reference.md, and tests/trident_skill_eval_tasks.md: update the overlap pitfall note to match the new ValueError.

Verification

3 focused tests pass (including the new synthetic test in tests/test_patcher_scan_order.py).

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