Skip to content

Issues with TIFFWSIReader #499

@jessecanada

Description

@jessecanada
  • TIA Toolbox version: latest from the develop branch
  • Python version: 3.8
  • Operating System: Ubuntu 20.04

I have a batch of ome.tiff that are not compatible with slide_thumbnail(). Attempting to read at any level causes MemoryError. It looks like it's trying to read the base level array. The work around is to use read_bounds(), and specify the resolution=top level. For instance, a sample ome.tiff has the following dimensions:

[157521 161047]
[78760 80523]
[39380 40261]
[19690 20131]
[ 9845 10065]

This doesn't work:

thumbnail = wsi_reader.slide_thumbnail(resolution=4, units="level")
plt.imshow(thumbnail)

I get MemoryError: Unable to allocate 70.9 GiB for an array with shape (161051, 157525, 3) and data type uint8

This works:

target_level = wsi_reader_v1.info.level_count - 1
bounds = [0, 0, *wsi_reader_v1.info.level_dimensions[-1]]
thumbnail = wsi_reader.read_bounds(
    bounds,
    resolution=target_level,
    units='level'
)

However, the resulting thumbnail has shape (629, 615, 3). Is that expected behavior?

Link to sample image: http://gofile.me/6VSoS/3cPUTcMiw


Update: Interestingly, if I specify coord_space = 'resolution' in read_bounds(), then I can reproduce the same memory error. Looks like that's where the bug is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleOld PRs/Issues which are inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions