ImageItem performance boost by avoiding makeQImage(transpose=True)

This commit is contained in:
Luke Campagnola 2013-11-24 20:45:10 -05:00
parent a08b28c958
commit bd2330af9f
2 changed files with 5 additions and 2 deletions

View File

@ -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:

View File

@ -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()