TissueImageAnalytics / tiatoolbox

Computational Pathology Toolbox developed by TIA Centre, University of Warwick.
https://warwick.ac.uk/tia
Other
340 stars 71 forks source link

🩹 Fix `save_tiles` #752

Closed measty closed 6 months ago

measty commented 7 months ago
codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (c3b49e6) 99.91% compared to head (934faff) 99.91%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #752 +/- ## ========================================= Coverage 99.91% 99.91% ========================================= Files 69 69 Lines 8507 8511 +4 Branches 1379 1636 +257 ========================================= + Hits 8500 8504 +4 Partials 7 7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Abdol commented 6 months ago

I ran more tests on 8 WSIs from OpenSlide samples and 5 from the ACROBAT dataset and I don't see any issues, except that the size of tiles becomes inconsistent at the edges of the WSI, e.g., instead of (1024, 1024) for a tile, you can get (x, 1024) or (x, y) with x and y being integer numbers less than 1024.

Here are some CSVs that showcase that (scroll to the bottom): CMU-3.ndpi-5x.csv CMU-3.svs-20x.csv JP2K-33003-1.svs-10x.csv

If that's expected behaviour, then feel free to close this PR.

measty commented 6 months ago

I ran more tests on 8 WSIs from OpenSlide samples and 5 from the ACROBAT dataset and I don't see any issues, except that the size of tiles becomes inconsistent at the edges of the WSI, e.g., instead of (1024, 1024) for a tile, you can get (x, 1024) or (x, y) with x and y being integer numbers less than 1024.

Here are some CSVs that showcase that (scroll to the bottom): CMU-3.ndpi-5x.csv CMU-3.svs-20x.csv JP2K-33003-1.svs-10x.csv

If that's expected behaviour, then feel free to close this PR.

As far as I know, that is the expected behaviour. Certainly that is how it behaved before on the slides where it was working, so in this PR I have not changed that, I have just fixed the behaviour on the slides where it was returning nonesense tiles at wrong resolutions.

If it is wanted that we change the behavior to return padded tiles near edges, it is a simple change; we just have to remove the lines:

            end_h = min(end_h, slide_h)
            end_w = min(end_w, slide_w)