Skip to content

Tile caching based on image path isn't enough whenever files change on disk #2012

@petebankhead

Description

@petebankhead

Bug report

Describe the bug

QuPath uses a tile cache to speed up reading pixels.

Often, that's based on the path (or URI) for the image.

That's fine if the image doesn't change. But if a file exists on disk and is then overwritten after QuPath has been launched, attempting to read the new file can result in seeing pixels from the old file.

To Reproduce

Steps to reproduce the behavior:

  1. Find a small z-stack, e.g. confocal-series.tif from the ImageJ samples
  2. Open the image is QuPath and browse a few slices - but not all slices
  3. Open a different image in QuPath
  4. Open the original image in ImageJ and change it (e.g. Edit → Invert), then save with the same file name
  5. Open the original (but now modified) image in QuPath
  6. See that some slices have been cached, while others are not

Expected behavior

Some confusion is acceptable if the file is overwritten while the same image is open within QuPath's viewer.

But if the image is closed and then reopened, 'old' pixels shouldn't be returned from the cache.

Desktop (please complete the following information):

  • OS: All
  • QuPath Version: v0.6.0 (and probably all versions before)

Additional context

Probably relates to #1964 (comment)

An easy 'solution' would be to eagerly eject tiles from the cache. But when tile requests are expensive, this could unnecessarily harm performance.

An alternative could be to append the last modified time for a file to what is returned by ImageServer.getPath() - or some other property that should not change unless the file is modified (file size may work most of the timel, but isn't ideal since this may not changed for uncompressed TIFF even if the image has been modified).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions