Skip to content

Commit

Permalink
TiffWrapper: fix zslice
Browse files Browse the repository at this point in the history
The problem was with files with more than one Series, TiffFile.asarray
would return only the first series in this case.
  • Loading branch information
gmazzamuto committed Jul 4, 2022
1 parent e374d2d commit e5d3701
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions zetastitcher/io/tiffwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,19 @@ def zslice(self, arg1, arg2=None, step=1, dtype=None, copy=True):
return np.array([])
a = tiff.imread(list(map(str, flist)))
else:
mma = self.tfile.asarray(out='memmap')
a = mma

for letter in 'ZQ':
if letter in self.axes:
if letter in self.axes and self.axes.index(letter) > 0:
# take only first element of left-most axes (e.g. time)
mma = self.tfile.asarray(out='memmap')
mma = mma[tuple(0 for _ in range(self.axes.index(letter)))]
if len(mma.shape) >= 3:
a = mma[myslice]
break
else:
try:
a = self.tfile.asarray(myslice, out=None if copy else 'memmap')
except StopIteration:
return np.array([])

if copy:
a = np.copy(a)
Expand Down

0 comments on commit e5d3701

Please sign in to comment.