Skip to content

Commit

Permalink
Merge pull request #1374 from girder/fix-ometiff-style
Browse files Browse the repository at this point in the history
Fix an issue with apply a frame style to ome tiffs
  • Loading branch information
manthey authored Nov 16, 2023
2 parents 2c006e2 + 2e4d2eb commit 32b8d01
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Default to "None" for the DICOM assetstore limit ([#1359](../../pull/1359))
- Fix series detection for some bioformats files ([#1365](../../pull/1365), [#1367](../../pull/1367))
- Fix time comparison in annotation history check ([#1369](../../pull/1369))
- Fix an issue with apply a frame style to ome tiffs ([#1374](../../pull/1374))

## 1.26.0

Expand Down
5 changes: 3 additions & 2 deletions sources/ometiff/large_image_source_ometiff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ def getNativeMagnification(self):
@methodcache()
def getTile(self, x, y, z, pilImageAllowed=False, numpyAllowed=False,
sparseFallback=False, **kwargs):
if (z < 0 or z >= len(self._omeLevels) or (
self._omeLevels[z] is not None and kwargs.get('frame') in (None, 0, '0', ''))):
if ((z < 0 or z >= len(self._omeLevels) or (
self._omeLevels[z] is not None and kwargs.get('frame') in (None, 0, '0', ''))) and
not getattr(self, '_style', None)):
return super().getTile(
x, y, z, pilImageAllowed=pilImageAllowed,
numpyAllowed=numpyAllowed, sparseFallback=sparseFallback,
Expand Down
4 changes: 3 additions & 1 deletion test/test_source_ometiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,6 @@ def testXMLParsing():
def testFrameStyleOMETiff():
imagePath = datastore.fetch('DDX58_AXL_EGFR_well2_XY01.ome.tif')
source = large_image_source_ometiff.open(imagePath, style={'bands': [{'frame': 4}]})
assert source.getTile(0, 0, 2)
tile1 = source.getTile(0, 0, 2)
tile2 = source.getTile(0, 0, 2, frame=1)
assert tile1 == tile2
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ exclude =
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D200,D205,D400,D401,E741,W504,B017

[pytest]
addopts = --verbose --strict-markers --showlocals --cov-report="term" --cov-report="xml" --cov-report="html" --cov --ignore test/utils --cov-context=test
addopts = --verbose --strict-markers --showlocals --cov-report="term" --cov-report="xml" --cov-report="html" --cov --ignore test/utils
# --cov-context=test
cache_dir = build/pytest_cache
testpaths =
test
Expand Down Expand Up @@ -322,7 +323,7 @@ parallel = True
[coverage:html]
directory = build/test/artifacts/python_coverage
title = Large image Coverage Report
show_contexts = True
# show_contexts = True

[coverage:xml]
output = build/test/coverage/py_coverage.xml

0 comments on commit 32b8d01

Please sign in to comment.