Skip to content

Commit

Permalink
bugfix/handle-tiff-i-dim (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
toloudis authored Nov 14, 2022
1 parent 8099b70 commit 7f68dd9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions aicsimageio/readers/tiff_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

###############################################################################

# "Q" is used by Gohlke to say "unknown dimension"
# https://github.com/cgohlke/tifffile/blob/master/tifffile/tifffile.py#L10840
UNKNOWN_DIM_CHAR = "Q"
# "Q" is used by tifffile to say "unknown dimension"
# "I" is used to mean a generic image sequence
UNKNOWN_DIM_CHARS = ["Q", "I"]
TIFF_IMAGE_DESCRIPTION_TAG_INDEX = 270

###############################################################################
Expand Down Expand Up @@ -192,7 +192,7 @@ def _merge_dim_guesses(dims_from_meta: str, guessed_dims: str) -> str:
best_guess = []
for dim_from_meta in dims_from_meta:
# Dim from meta is recognized, add it
if dim_from_meta != UNKNOWN_DIM_CHAR:
if dim_from_meta not in UNKNOWN_DIM_CHARS:
best_guess.append(dim_from_meta)

# Dim from meta isn't recognized
Expand Down Expand Up @@ -220,7 +220,7 @@ def _guess_tiff_dim_order(self, tiff: TiffFile) -> List[str]:
dims_from_meta = scene.pages.axes

# If all dims are known, simply return as list
if UNKNOWN_DIM_CHAR not in dims_from_meta:
if all(i not in UNKNOWN_DIM_CHARS for i in dims_from_meta):
return [d for d in dims_from_meta]

# Otherwise guess the dimensions and return merge
Expand Down

0 comments on commit 7f68dd9

Please sign in to comment.