DigitalSlideArchive/digital_slide_archive

Error when opening a large image format

spatre opened this issue ยท 6 comments

I'm getting this RuntimeError('Incompatible keyframe') when I click on the large image icon to open the .btf image.

image

This works fine on an older version of DSA(I'm able to open it properly) but not in the latest.
Below is the error.log when I click on large image icon.

[2022-07-29 20:49:43,511] ERROR: 500 Error
Traceback (most recent call last):
  File "/opt/girder/girder/api/rest.py", line 649, in endpointDecorator
    val = fun(self, path, params)
  File "/opt/girder/girder/api/rest.py", line 1238, in POST
    return self.handleRoute(method, path, params)
  File "/opt/girder/girder/api/rest.py", line 977, in handleRoute
    val = handler(**kwargs)
  File "/opt/girder/girder/api/access.py", line 57, in wrapped
    return fun(*args, **kwargs)
  File "/opt/girder/girder/api/rest.py", line 400, in wrapped
    return fun(*args, **kwargs)
  File "/opt/girder/girder/api/rest.py", line 430, in wrapped
    val = fun(*args, **kwargs)
  File "/opt/large_image/girder/girder_large_image/rest/tiles.py", line 222, in createTiles
    return self.imageItemModel.createImageItem(
  File "/opt/large_image/girder/girder_large_image/models/image_item.py", line 77, in createImageItem
    sourceName = girder_tilesource.getGirderTileSourceName(item, fileObj)
  File "/opt/large_image/girder/girder_large_image/girder_tilesource.py", line 175, in getGirderTileSourceName
    if AvailableGirderTileSources[sourceName].canRead(item):
  File "/opt/large_image/large_image/tilesource/base.py", line 2526, in canRead
    cls(path, *args, **kwargs)
  File "/opt/large_image/large_image/cache_util/cache.py", line 204, in __call__
    raise exc
  File "/opt/large_image/large_image/cache_util/cache.py", line 197, in __call__
    instance = super().__call__(*args, **kwargs)
  File "/opt/large_image/sources/tifffile/large_image_source_tifffile/__init__.py", line 102, in __init__
    for idx, s in enumerate(self._tf.series):
  File "/.pyenv/versions/3.9.13/lib/python3.9/functools.py", line 993, in __get__
    val = self.func(instance)
  File "/opt/venv/lib/python3.9/site-packages/tifffile/tifffile.py", line 3953, in series
    series = getattr(self, '_series_' + name)()
  File "/opt/venv/lib/python3.9/site-packages/tifffile/tifffile.py", line 4500, in _series_sis
    pages = self.pages._getlist(validate=False)
  File "/opt/venv/lib/python3.9/site-packages/tifffile/tifffile.py", line 6368, in _getlist
    pages = [getitem(i, validate=validhash) for i in key]
  File "/opt/venv/lib/python3.9/site-packages/tifffile/tifffile.py", line 6368, in <listcomp>
    pages = [getitem(i, validate=validhash) for i in key]
  File "/opt/venv/lib/python3.9/site-packages/tifffile/tifffile.py", line 6415, in _getitem
    page = tiffpage(self.parent, index=pageindex, keyframe=self._keyframe)
  File "/opt/venv/lib/python3.9/site-packages/tifffile/tifffile.py", line 8648, in __init__
    raise RuntimeError('incompatible keyframe')
RuntimeError: incompatible keyframe

It would be great if you can suggest me what to do to resolve this. Thank you.

Hmm... It looks like your file is trying to be opened via the tifffile source (which didn't exist until a few weeks ago). You can manually uninstall large-image-source-tifffile, but the right solution is to detect that this file shouldn't be handled via that source. I'll look into it further next week.

Would you happen to have a file that can be used for public testing that shows the problem?

Thank you so much. Let me see If I can find a public BigTiff image that can be used to test this. The one I'm using is from a private dataset.

@manthey Unfortunately I couldn't find any public image that could be used to test this usecase. However, when I ran the "identify" command from Imagemagick on this image file, I got the below.

hu_prostate_PC4-20200605_2019_01.btf[0] TIFF64 45048x40466 45048x40466+0+0 8-bit sRGB 5.09903GiB 0.010u 0:00.007
hu_prostate_PC4-20200605_2019_01.btf[1] TIFF64 27x25 27x25+0+0 16-bit Grayscale Gray 0.010u 0:00.003 

I think this will be fixed by girder/large_image#903.

That will get built into the dockers later today.

I'll close this (the dockers should be rebuilt in ~ 1 hour). Please reopen if it isn't resolved.

@manthey I pulled the updated dockers and it worked like a charm! Thanks so much for your swift action on this issue.