apply the efflut early for uint16 mono/rgb, uint8 rgb
This commit is contained in:
parent
38fbb3fa46
commit
29ad432f5a
@ -455,9 +455,21 @@ class ImageItem(GraphicsObject):
|
|||||||
lut = self._effectiveLut
|
lut = self._effectiveLut
|
||||||
levels = None
|
levels = None
|
||||||
|
|
||||||
|
if image.dtype == self._xp.uint16 or (image.ndim == 3 and image.shape[2] == 3):
|
||||||
|
# apply the effective lut early for the following types:
|
||||||
|
# 1) uint16 mono
|
||||||
|
# 2) {uint8, uint16} rgb
|
||||||
|
# this converts the input image to an uint8 image of shape
|
||||||
|
# (h, w) or (h, w, 3) or (h, w, 4), depending on the lut's shape.
|
||||||
|
# we don't do it for uint8 mono so that it will use Format_Indexed8
|
||||||
|
image = fn.applyLookupTable(image, lut)
|
||||||
|
lut = None
|
||||||
|
# now both levels and lut are None
|
||||||
|
|
||||||
# when calling makeARGB() with lut and no levels, we need to
|
# when calling makeARGB() with lut and no levels, we need to
|
||||||
# explicitly set scale. This ensures that makeARGB() will skip
|
# explicitly set scale. This ensures that makeARGB() will skip
|
||||||
# applying levels.
|
# applying levels.
|
||||||
|
if lut is not None:
|
||||||
scale = lut.shape[0] - 1
|
scale = lut.shape[0] - 1
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user