Commit bd2330af authored by Luke Campagnola's avatar Luke Campagnola
Browse files

ImageItem performance boost by avoiding makeQImage(transpose=True)

parent a08b28c9
......@@ -875,6 +875,9 @@ def makeARGB(data, lut=None, levels=None, scale=None, useRGBA=False):
order = [2,1,0,3] ## for some reason, the colors line up as BGR in the final image.
if data.ndim == 2:
# This is tempting:
# imgData[..., :3] = data[..., np.newaxis]
# ..but it turns out this is faster:
for i in range(3):
imgData[..., i] = data
elif data.shape[2] == 1:
......
......@@ -260,8 +260,8 @@ class ImageItem(GraphicsObject):
#print lut.shape
#print self.lut
argb, alpha = fn.makeARGB(self.image, lut=lut, levels=self.levels)
self.qimage = fn.makeQImage(argb, alpha)
argb, alpha = fn.makeARGB(self.image.T, lut=lut, levels=self.levels)
self.qimage = fn.makeQImage(argb, alpha, transpose=False)
prof.finish()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment