imi-bigpicture / wsidicom

Python package for reading DICOM WSI file sets.
Apache License 2.0
32 stars 5 forks source link

read_region() : blank spaces not blank as zoom level increases #47

Closed chlmarchal closed 2 years ago

chlmarchal commented 2 years ago

Hello!

I wanted to use your library to read some WSI Dicom files. In this case, I took the image "melanoma_pilot_003" that can be seen in file "region_wsidicom_level7".

I wanted to use the read_window function to extract a particular window from the image:

from wsidicom import WsiDicom

slide = WsiDicom.open("./melanoma_pilot_003")
region = slide.read_region((0, 0),4, (3968, 4672))
region.save("./region_wsidicom_level4.png", format="png")

When I increase the zoom level the image area that is supposed to be blank is not. As I increase the zoom level, the image is repeated more and more. This can be seen in images "region_wsidicom_level5" and "region_wsidicom_level4", where the bottom of the images that is suppose to be blank isn't. This can be compared with the image obtained at zoom level 7 where there is nothing in the blank areas.

Have you already observed this phenomenon?

Have a nice day!

region_wsidicom_level4 region_wsidicom_level5 region_wsidicom_level7

erikogabrielsson commented 2 years ago

Thanks for reporting this @chlmarchal. This is actually a bug in opentile, which was used to dicomize the tiff-files. The function for generating blank tiles to fill in the sparse tiles in the tiff file takes the first valid tile in the pyramid level (e.g. the top left corner) and fills it with the background color. The left the ac components unchanged, and those thus appeared in the blank tiles.

chlmarchal commented 2 years ago

Thanks for the information and your pull request.