Skip to content

Commit 495977b

Browse files
committed
Fix a bug in subimage reading, when target image has multiple channels
1 parent 1fe8f0d commit 495977b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bioformats/formatreader.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,12 @@ def read(self, c = None, z = 0, t = 0, series = None, index = None,
811811
n_planes = self.rdr.getRGBChannelCount()
812812
rdr = ChannelSeparator(self.rdr)
813813
planes = [
814-
np.frombuffer(rdr.openBytes(rdr.getIndex(z,i,t)),dtype)
815-
for i in range(n_planes)]
814+
np.frombuffer(
815+
(rdr.openBytes(rdr.getIndex(z,i,t)) if XYWH is None else
816+
rdr.openBytesXYWH(rdr.getIndex(z,i,t), XYWH[0], XYWH[1], XYWH[2], XYWH[3])),
817+
dtype
818+
) for i in range(n_planes)]
819+
816820
if len(planes) > 3:
817821
planes = planes[:3]
818822
elif len(planes) < 3:

0 commit comments

Comments
 (0)