Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions bioformats/formatreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,15 +821,12 @@ def read(self, c = None, z = 0, t = 0, series = None, index = None,
logger.warning("WARNING: failed to get MaxSampleValue for image. Intensities may be improperly scaled.")
if index is not None:
image = np.frombuffer(openBytes_func(index), dtype)
if len(image) / height / width in (3,4):
n_channels = int(len(image) / height / width)
if self.rdr.isInterleaved():
image.shape = (height, width, n_channels)
else:
image.shape = (n_channels, height, width)
image = image.transpose(1, 2, 0)
n_channels = int(len(image) / height / width)
if self.rdr.isInterleaved():
image.shape = (height, width, n_channels)
else:
image.shape = (height, width)
image.shape = (n_channels, height, width)
image = image.transpose(1, 2, 0)
elif self.rdr.isRGB() and self.rdr.isInterleaved():
index = self.rdr.getIndex(z,0,t)
image = np.frombuffer(openBytes_func(index), dtype)
Expand Down