Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit e2dd9c7

Browse files
authored
try to use optimized codepath through ome-types (#478)
* try to use optimized codepath through ome-types * update test * fix lint * remove recently deprecated iteritems
1 parent ea258b1 commit e2dd9c7

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

aicsimageio/readers/ome_tiff_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _get_ome(ome_xml: str, clean_metadata: bool = True) -> OME:
6868
if clean_metadata:
6969
ome_xml = metadata_utils.clean_ome_xml_for_known_issues(ome_xml)
7070

71-
return from_xml(ome_xml)
71+
return from_xml(ome_xml, parser="lxml")
7272

7373
@staticmethod
7474
def _is_supported_image(

aicsimageio/readers/tiff_glob_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def _read_immediate(self) -> xr.DataArray:
408408
chunk_sizes = self._get_chunk_sizes(scene_nunique)
409409

410410
unpack_sizes = OrderedDict(
411-
[(d, s) for d, s in scene_nunique.iteritems() if d in chunk_sizes.keys()]
411+
[(d, s) for d, s in scene_nunique.items() if d in chunk_sizes.keys()]
412412
)
413413

414414
reshape_sizes = tuple(unpack_sizes.values()) + tuple(

aicsimageio/tests/writers/test_ome_tiff_writer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
import urllib
54
from typing import Callable, List, Optional, Tuple, Union
65

6+
import lxml
77
import numpy as np
88
import pytest
99
from ome_types import to_xml
@@ -166,7 +166,7 @@ def test_ome_tiff_writer_no_meta(
166166
"bad ome string",
167167
"TCZYX",
168168
# raised from within ome-types
169-
marks=pytest.mark.xfail(raises=urllib.error.URLError),
169+
marks=pytest.mark.xfail(raises=lxml.etree.XMLSyntaxError),
170170
),
171171
],
172172
)

aicsimageio/writers/ome_tiff_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def save(
255255
)
256256
# else if string, then construct OME from string
257257
elif isinstance(ome_xml, str):
258-
ome_xml = from_xml(ome_xml)
258+
ome_xml = from_xml(ome_xml, parser="lxml")
259259

260260
# if we do not have an OME object now, something is wrong
261261
if not isinstance(ome_xml, OME):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def run(self):
105105
"imagecodecs>=2020.5.30",
106106
"lxml>=4.6,<5",
107107
"numpy>=1.16,<2",
108-
"ome-types>=0.2",
108+
"ome-types>=0.3.3",
109109
"ome-zarr>=0.6.1",
110110
"wrapt>=1.12",
111111
"resource-backed-dask-array>=0.1.0",

0 commit comments

Comments
 (0)