def open_bytes_simple(self, plane):
"""\
Obtain the image plane for the given index as a numpy array, or a
list of numpy arrays in the RGB case.
"""
# Fetch 9D array
a = self.open_bytes(plane)
# Drop all unused dimensions
s = np.squeeze(a, axis=(2, 3, 4, 6, 7, 8))
# Swap x,y to y,x
s = np.swapaxes(s, 0, 1)
# Split RGB samples into separate arrays
if s.shape[2] == 1:
return np.squeeze(s, axis=2)
else:
return [s[:, :, i] for i in range(0, s.shape[2])]
评论列表
文章目录