fix: support colormaps of shape (h, 1)

This commit is contained in:
KIU Shueng Chuan 2021-04-10 14:47:58 +08:00
parent 941a436df7
commit a6bbb1c48c

View File

@ -529,7 +529,7 @@ class ImageItem(GraphicsObject):
# levels and/or lut --> lut-only # levels and/or lut --> lut-only
fmt = QtGui.QImage.Format.Format_Indexed8 fmt = QtGui.QImage.Format.Format_Indexed8
if lut.ndim == 1 or lut.shape[1] == 1: if lut.ndim == 1 or lut.shape[1] == 1:
ctbl = [QtGui.qRgb(x,x,x) for x in lut.tolist()] ctbl = [QtGui.qRgb(x,x,x) for x in lut.ravel().tolist()]
elif lut.shape[1] == 3: elif lut.shape[1] == 3:
ctbl = [QtGui.qRgb(*rgb) for rgb in lut.tolist()] ctbl = [QtGui.qRgb(*rgb) for rgb in lut.tolist()]
elif lut.shape[1] == 4: elif lut.shape[1] == 4: