From 389ba1d25a4da70e96e83d1a6a10d5c870455a92 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Sun, 20 Feb 2022 12:15:12 -0500 Subject: [PATCH] admin/bump-nd2-v0.2.0 (#379) * bump version * bump t v2 --- aicsimageio/readers/nd2_reader.py | 9 ++------- setup.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/aicsimageio/readers/nd2_reader.py b/aicsimageio/readers/nd2_reader.py index 53904f4fb..30670b646 100644 --- a/aicsimageio/readers/nd2_reader.py +++ b/aicsimageio/readers/nd2_reader.py @@ -6,7 +6,6 @@ from .. import constants, exceptions, types from ..utils import io_utils -from ..utils.dask_proxy import DaskArrayProxy from .reader import Reader if TYPE_CHECKING: @@ -16,7 +15,6 @@ try: import nd2 - from nd2._util import NEW_HEADER_MAGIC, OLD_HEADER_MAGIC except ImportError: raise ImportError( "The nd2 package is required for this reader. " @@ -42,8 +40,7 @@ class ND2Reader(Reader): @staticmethod def _is_supported_image(fs: AbstractFileSystem, path: str, **kwargs: Any) -> bool: - with fs.open(path, "rb") as fh: - return fh.read(4) in (NEW_HEADER_MAGIC, OLD_HEADER_MAGIC) + return nd2.is_supported_file(path, fs.open) def __init__(self, image: types.PathLike): self._fs, self._path = io_utils.pathlike_to_fs(image, enforce_exists=True) @@ -75,10 +72,8 @@ def _xarr_reformat(self, delayed: bool) -> xr.DataArray: xarr = rdr.to_xarray( delayed=delayed, squeeze=False, position=self.current_scene_index ) - if delayed: - xarr.data = DaskArrayProxy(xarr.data, rdr) xarr.attrs[constants.METADATA_UNPROCESSED] = xarr.attrs.pop("metadata") - return xarr.isel({nd2._util.AXIS.POSITION: 0}) + return xarr.isel({nd2.AXIS.POSITION: 0}) @property def physical_pixel_sizes(self) -> types.PhysicalPixelSizes: diff --git a/setup.py b/setup.py index 70810dd70..f1ce51960 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def run(self): format_libs: Dict[str, List[str]] = { "base-imageio": ["imageio[ffmpeg]>=2.9.0,<2.11.0", "Pillow>=8.2.0,!=8.3.0,<9"], "czi": ["aicspylibczi>=3.0.4"], - "nd2": ["nd2[legacy]==0.1.4"], + "nd2": ["nd2[legacy]>=0.2.0"], "dv": ["mrc>=0.2.0"], # "bioformats": ["bioformats_jar"], # excluded for licensing reasons # "lif": ["readlif>=0.6.4"], # excluded for licensing reasons