Skip to content

Commit

Permalink
Fix an issue when tifffile reports no key frame
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Dec 5, 2023
1 parent 21d6864 commit 3b5317b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 1.26.3

### Bug Fixes
- Fix an issue when tifffile reports no key frame ([#1396](../../pull/1396))

## 1.26.2

### Improvements
Expand Down Expand Up @@ -436,6 +441,7 @@
### Bug Fixes
- Use open.read rather than download to access files in Girder ([#989](../../pull/989))
- Fix nd2 source scale ([#990](../../pull/990))
- Do not raise a login request when checking if the user can write annotations ([#991](../../pull/991))

## 1.17.3

Expand Down
4 changes: 2 additions & 2 deletions sources/tifffile/large_image_source_tifffile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ def _findAssociatedImages(self):
Find associated images from unused pages and series.
"""
pagesInSeries = [p for s in self._tf.series for ll in s.pages.levels for p in ll.pages]
hashes = [p.hash for p in pagesInSeries if p.keyframe is not None]
hashes = [p.hash for p in pagesInSeries if getattr(p, 'keyframe', None) is not None]
self._associatedImages = {}
for p in self._tf.pages:
if (p not in pagesInSeries and p.keyframe is not None and
if (p not in pagesInSeries and getattr(p, 'keyframe', None) is not None and
p.hash not in hashes and not len(set(p.axes) - set('YXS'))):
id = 'image_%s' % p.index
entry = {'page': p.index}
Expand Down
2 changes: 2 additions & 0 deletions test/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
'synthetic_multiaxis.zarr.zip': 'sha512:95da53061bd09deaf4357e745404780d78a0949935f82c10ee75237e775345caace18fad3f05c3452ba36efca6b3ed58d815d041f33197497ab53d2c80b9e2ac', # noqa
# Single flat array zarr
'flat2.zarr.zip': 'sha512:c49ff5fbfa73615da4c2a7c8602723297d604892b848860a068ab200245eec6c4f638f35d0b40cde0233c55faa6dc4e46351a841b481211f36dc5fb43765d818', # noqa
# OME tiff where tifffile reports no keyframe
'test_nokeyframe.ome.tiff': 'sha512:e810420ece0688bf4e1c347ef7e172a303a9cb3f0d56efc3d0068ec40decf05d2588b01a3f5ac9857ccf8f3d088819e532148488f30ad693d6d79c1aa66115d7', # noqa
}


Expand Down
11 changes: 9 additions & 2 deletions test/test_source_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
'gdal': {
'read': r'\.(jpg|jpeg|jp2|ptif|scn|svs|tif.*|qptiff)$',
'noread': r'(huron\.image2_jpeg2k|sample_jp2k_33003|TCGA-DU-6399|\.(ome.tiff|nc)$)',
'skip': r'nokeyframe\.ome\.tiff$',
'skipTiles': r'\.*nc$',
},
'mapnik': {
'read': r'\.(jpg|jpeg|jp2|ptif|nc|scn|svs|tif.*|qptiff)$',
'noread': r'(huron\.image2_jpeg2k|sample_jp2k_33003|TCGA-DU-6399|\.(ome.tiff)$)',
'skip': r'nokeyframe\.ome\.tiff$',
# we should only test this with a projection
'skipTiles': r'',
},
Expand All @@ -53,11 +55,15 @@
'nd2': {
'read': r'\.(nd2)$',
},
'ometiff': {'read': r'\.(ome\.tif.*)$'},
'ometiff': {
'read': r'\.(ome\.tif.*)$',
'noread': r'nokeyframe\.ome\.tiff$',
},
'openjpeg': {'read': r'\.(jp2)$'},
'openslide': {
'read': r'\.(ptif|svs|tif.*|qptiff|dcm)$',
'noread': r'(oahu|DDX58_AXL|huron\.image2_jpeg2k|landcover_sample|d042-353\.crop|US_Geo\.|extraoverview|imagej|bad_axes)', # noqa
'skip': r'nokeyframe\.ome\.tiff$',
'skipTiles': r'one_layer_missing',
},
'pil': {
Expand All @@ -67,13 +73,14 @@
'rasterio': {
'read': r'\.(jpg|jpeg|jp2|ptif|scn|svs|tif.*|qptiff)$',
'noread': r'(huron\.image2_jpeg2k|sample_jp2k_33003|TCGA-DU-6399|\.(ome.tiff|nc)$)',
'skip': r'nokeyframe\.ome\.tiff$',
},
'test': {'any': True, 'skipTiles': r''},
'tiff': {
'read': r'\.(ptif|scn|svs|tif.*|qptiff)$',
'noread': r'(oahu|DDX58_AXL|G10-3_pelvis_crop|'
r'd042-353\.crop\.small\.float|landcover_sample|US_Geo\.|'
r'imagej|bad_axes)',
r'imagej|bad_axes|nokeyframe\.ome\.tiff$)',
'skipTiles': r'(sample_image\.ptif|one_layer_missing_tiles)'},
'tifffile': {
'read': r'',
Expand Down

0 comments on commit 3b5317b

Please sign in to comment.