Skip to content

Commit

Permalink
Merge branch 'main' into admin/remove-czi-install-pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonMaxfield committed Feb 22, 2022
2 parents 3e86877 + 389ba1d commit 1137c4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions aicsimageio/readers/nd2_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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. "
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def run(self):
"imageio[ffmpeg]>=2.9.0,<2.11.0",
"Pillow>=8.2.0,!=8.3.0,<9",
],
"nd2": ["nd2[legacy]==0.1.4"],
"nd2": ["nd2[legacy]>=0.2.0"],
"dv": ["mrc>=0.2.0"],
# "czi": ["aicspylibczi>=3.0.5"], # excluded for licensing reasons
# "bioformats": ["bioformats_jar"], # excluded for licensing reasons
Expand Down

0 comments on commit 1137c4e

Please sign in to comment.