8000 Preserve base tile_size and pixel_overlap across extract calls with mpp by chenyangsu · Pull Request #896 · histolab/histolab · GitHub
[go: up one dir, main page]

Skip to content

Preserve base tile_size and pixel_overlap across extract calls with mpp - #896

Open
chenyangsu wants to merge 1 commit into
histolab:mainfrom
chenyangsu:fix/tiler-mpp-reuse
Open

chenyangsu wants to merge 1 commit into
histolab:mainfrom
chenyangsu:fix/tiler-mpp-reuse

Conversation

@chenyangsu
Copy link
Copy Markdown

Description

Reusing a GridTiler, RandomTiler, or ScoreTiler configured with mpp across two Slide instances compounds self.tile_size and self.pixel_overlap on each extract call. For tile_size=(128, 128) and mpp=0.75 on CMU_1_SMALL_REGION (base_mpp=0.499), the first call scales tile_size to (192, 192) and the second scales it to (288, 288), raising RuntimeError inside Slide.extract_tile against final_tile_size=(128, 128).

Storing _base_tile_size and _base_pixel_overlap at initialization keeps each extract call relative to the original arguments while preserving the scaled tile_size and pixel_overlap attributes expected by tests/integration/test_tiler.py. Happy to compute local scaled values inside extract instead if mutating those attributes is not needed.

Testing: pytest tests/unit/test_tiler.py tests/unit/test_tiler_mpp_reuse.py (96 passed; all 3 new reuse tests failed before), pytest tests/integration/test_tiler.py (44 passed, 11 skipped), flake8, black --check, isort --check, and bandit passed.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

  • Fixes: N/A

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

This branch has not been deployed

No deployments
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

0