Open kaczmarj opened 1 month ago
i suspect the jpeg2000 compression has something to do with this, because i cannot reproduce in images that have other compression schemes.
the camelyon16 dataset uses jpeg2000.
the difference is much more pronounced in test_034
# Download the image
aws s3 cp --no-sign-request s3://camelyon-dataset/CAMELYON16/images/test_034.tif .
x, y = 56606, 43386
s = 566
tslide = tiffslide.TiffSlide("test_034.tif")
oslide = openslide.OpenSlide("test_034.tif")
tslide.read_region((x, y), level=0, size=(s, s))
oslide.read_region((x, y), level=0, size=(s, s))
Interesting... Seems there is something different about the lowest level in the tif file.
This is broken in tifffile<=2024.4.24
and is fixed with tifffile>=2024.5.3
import tiffslide
import PIL.Image
s = tiffslide.open_slide("./test_034.tif")
PIL.Image.fromarray(s.zarr_group[1][::32,::32,:]).save("out1.png")
PIL.Image.fromarray(s.zarr_group[0][::64,::64,:]).save("out0.png")
tifffile<=2024.4.24
)tifffile>=2024.5.3
)that's great! thanks for this. i'm glad the fix is already out. feel free to close the issue if there is nothing else to do.
Until tiffslide requires a newer tifffile version we'll keep this open so that people find it more easily.
And thank you for reporting, and providing a reproducible example ❤️
i have come across unexpected behavior when reading a tile from the CAMELYON16 dataset, slide
test_019.tif
. please see code to reproduce below.download image
test_019.tif
using:Tile read using tiffslide
Tile read using openslide
takeaway
as you can see, the tile read using tiffslide is different from that using openslide. i wonder if jpeg2000 compression is an issue here?