add support for Format_RGBA64
This commit is contained in:
parent
eba908632a
commit
941a436df7
@ -428,8 +428,8 @@ class ImageItem(GraphicsObject):
|
|||||||
# can't handle multi-channel levels
|
# can't handle multi-channel levels
|
||||||
break
|
break
|
||||||
if image.dtype == self._xp.uint16 and levels is None and \
|
if image.dtype == self._xp.uint16 and levels is None and \
|
||||||
image.ndim == 3 and image.shape[2] in (3, 4):
|
image.ndim == 3 and image.shape[2] == 3:
|
||||||
# uint16 rgb(a) can't be directly displayed, so make them
|
# uint16 rgb can't be directly displayed, so make it
|
||||||
# pass through effective lut processing
|
# pass through effective lut processing
|
||||||
levels = [0, 65535]
|
levels = [0, 65535]
|
||||||
if levels is None and lut is None:
|
if levels is None and lut is None:
|
||||||
@ -501,11 +501,12 @@ class ImageItem(GraphicsObject):
|
|||||||
is_passthru8 = ubyte_nolvl and lut is None
|
is_passthru8 = ubyte_nolvl and lut is None
|
||||||
is_indexed8 = ubyte_nolvl and image.ndim == 2 and \
|
is_indexed8 = ubyte_nolvl and image.ndim == 2 and \
|
||||||
lut is not None and lut.shape[0] == 256
|
lut is not None and lut.shape[0] == 256
|
||||||
can_grayscale16 = image.dtype == numpy.uint16 and image.ndim == 2 and \
|
is_passthru16 = image.dtype == numpy.uint16 and levels is None and lut is None
|
||||||
levels is None and lut is None and \
|
can_grayscale16 = is_passthru16 and image.ndim == 2 and \
|
||||||
hasattr(QtGui.QImage.Format, 'Format_Grayscale16')
|
hasattr(QtGui.QImage.Format, 'Format_Grayscale16')
|
||||||
|
is_rgba64 = is_passthru16 and image.ndim == 3 and image.shape[2] == 4
|
||||||
|
|
||||||
if is_passthru8 or is_indexed8 or can_grayscale16:
|
if is_passthru8 or is_indexed8 or can_grayscale16 or is_rgba64:
|
||||||
# bypass makeARGB for supported combinations
|
# bypass makeARGB for supported combinations
|
||||||
self._processingBuffer = None
|
self._processingBuffer = None
|
||||||
self._displayBuffer = None
|
self._displayBuffer = None
|
||||||
@ -537,6 +538,10 @@ class ImageItem(GraphicsObject):
|
|||||||
# single channel uint16
|
# single channel uint16
|
||||||
# both levels and lut are None
|
# both levels and lut are None
|
||||||
fmt = QtGui.QImage.Format.Format_Grayscale16
|
fmt = QtGui.QImage.Format.Format_Grayscale16
|
||||||
|
elif is_rgba64:
|
||||||
|
# uint16 rgba
|
||||||
|
# both levels and lut are None
|
||||||
|
fmt = QtGui.QImage.Format.Format_RGBA64 # endian-independent
|
||||||
if fmt is None:
|
if fmt is None:
|
||||||
raise ValueError("unsupported image type")
|
raise ValueError("unsupported image type")
|
||||||
self.qimage = fn._ndarray_to_qimage(image, fmt)
|
self.qimage = fn._ndarray_to_qimage(image, fmt)
|
||||||
|
Loading…
Reference in New Issue
Block a user