Skip to content

Commit

Permalink
Apply review suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
matham committed Apr 22, 2024
1 parent c083b5e commit ab033e1
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions cellfinder/core/tools/IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ def read_z_stack(path):
:return: The data as a dask/numpy array.
"""
if path.endswith(".tiff") or path.endswith(".tif"):
tiff = TiffFile(path)
if not len(tiff.series):
raise ValueError(
f"Attempted to load {path} but couldn't read a z-stack"
)
if len(tiff.series) != 1:
raise ValueError(
f"Attempted to load {path} but found multiple stacks"
)

axes = tiff.series[0].axes.lower()
if set(axes) != {"x", "y", "z"} or axes[0].lower() != "z":
raise ValueError(
f"Attempted to load {path} but didn't find a zyx or "
f"zxy stack. Found {axes} axes"
)
with TiffFile(path) as tiff:
if not len(tiff.series):
raise ValueError(

Check warning on line 41 in cellfinder/core/tools/IO.py

View check run for this annotation

Codecov / codecov/patch

cellfinder/core/tools/IO.py#L38-L41

Added lines #L38 - L41 were not covered by tests
f"Attempted to load {path} but couldn't read a z-stack"
)
if len(tiff.series) != 1:
raise ValueError(

Check warning on line 45 in cellfinder/core/tools/IO.py

View check run for this annotation

Codecov / codecov/patch

cellfinder/core/tools/IO.py#L44-L45

Added lines #L44 - L45 were not covered by tests
f"Attempted to load {path} but found multiple stacks"
)

axes = tiff.series[0].axes.lower()
if set(axes) != {"x", "y", "z"} or axes[0] != "z":
raise ValueError(

Check warning on line 51 in cellfinder/core/tools/IO.py

View check run for this annotation

Codecov / codecov/patch

cellfinder/core/tools/IO.py#L49-L51

Added lines #L49 - L51 were not covered by tests
f"Attempted to load {path} but didn't find a zyx or "
f"zxy stack. Found {axes} axes"
)

return imread(path)

Check warning on line 56 in cellfinder/core/tools/IO.py

View check run for this annotation

Codecov / codecov/patch

cellfinder/core/tools/IO.py#L56

Added line #L56 was not covered by tests

Expand Down

0 comments on commit ab033e1

Please sign in to comment.