Dana-Farber-AIOS / pathml

Compare 1bcbbc2 ... +2 ... 278e4a0

Showing 1 of 2 files from the diff.

@@ -198,16 +198,19 @@
Loading
198 198
199 199
        stride_i, stride_j = stride
200 200
201 -
        if pad:
202 -
            n_chunk_i = i // stride_i + 1
203 -
            n_chunk_j = j // stride_j + 1
204 -
201 +
        # calculate number of expected tiles
202 +
        # check for tile shape evenly dividing slide shape to fix https://github.com/Dana-Farber-AIOS/pathml/issues/305
203 +
        if pad and i % stride_i != 0:
204 +
            n_tiles_i = i // stride_i + 1
205 +
        else:
206 +
            n_tiles_i = (i - shape[0]) // stride_i + 1
207 +
        if pad and j % stride_j != 0:
208 +
            n_tiles_j = j // stride_j + 1
205 209
        else:
206 -
            n_chunk_i = (i - shape[0]) // stride_i + 1
207 -
            n_chunk_j = (j - shape[1]) // stride_j + 1
210 +
            n_tiles_j = (j - shape[1]) // stride_j + 1
208 211
209 -
        for ix_i in range(n_chunk_i):
210 -
            for ix_j in range(n_chunk_j):
212 +
        for ix_i in range(n_tiles_i):
213 +
            for ix_j in range(n_tiles_j):
211 214
                coords = (int(ix_i * stride_i), int(ix_j * stride_j))
212 215
                # get image for tile
213 216
                tile_im = self.extract_region(location=coords, size=shape, level=level)
@@ -549,16 +552,19 @@
Loading
549 552
550 553
        stride_i, stride_j = stride
551 554
552 -
        if pad:
553 -
            n_chunk_i = i // stride_i + 1
554 -
            n_chunk_j = j // stride_j + 1
555 -
555 +
        # calculate number of expected tiles
556 +
        # check for tile shape evenly dividing slide shape to fix https://github.com/Dana-Farber-AIOS/pathml/issues/305
557 +
        if pad and i % stride_i != 0:
558 +
            n_tiles_i = i // stride_i + 1
559 +
        else:
560 +
            n_tiles_i = (i - shape[0]) // stride_i + 1
561 +
        if pad and j % stride_j != 0:
562 +
            n_tiles_j = j // stride_j + 1
556 563
        else:
557 -
            n_chunk_i = (i - shape[0]) // stride_i + 1
558 -
            n_chunk_j = (j - shape[1]) // stride_j + 1
564 +
            n_tiles_j = (j - shape[1]) // stride_j + 1
559 565
560 -
        for ix_i in range(n_chunk_i):
561 -
            for ix_j in range(n_chunk_j):
566 +
        for ix_i in range(n_tiles_i):
567 +
            for ix_j in range(n_tiles_j):
562 568
                coords = (int(ix_i * stride_i), int(ix_j * stride_j))
563 569
                if coords[0] + shape[0] < i and coords[1] + shape[1] < j:
564 570
                    # get image for tile

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
pathml 0.01% 86.88%
Project Totals (26 files) 86.88%
Loading