Skip to content

Bypass makeARGB#1786

Merged
outofculture merged 48 commits intopyqtgraph:masterfrom
outofculture:cupify-1693
May 20, 2021
Merged

Bypass makeARGB#1786
outofculture merged 48 commits intopyqtgraph:masterfrom
outofculture:cupify-1693

Conversation

@outofculture
Copy link
Copy Markdown
Contributor

This continues #1693 but with corrected cupy behavior.

@pijyoi yeah, the lookup table substrate was the problem.

With that, this branch now provides across-the-board improvements to cupy-enabled benchmarks!

pijyoi added 30 commits April 13, 2021 03:42
Grayscale8 and RGB888 images are those that are ready for display
without further processing.
you can index (y, x) into a lookup table of shape (nentry, 3) or
(nentry, 4) and get an output of shape (y, x, 3) or (y, x, 4)
this allows uint16 images with user lut to be rendered as
Format_Indexed8
this efflut will then be used for Indexed8 format color table.

previously, we would be taking a performance hit with doing a numpy
lookup with levels_lut.
i.e. no more using lut to do rescale of uint16 image data.
use "xp" instead of numpy module
@outofculture
Copy link
Copy Markdown
Contributor Author

Huh. I'm just now noticing that I've been completely neglecting RawImageWidget, which uses makeARGB.

@pijyoi
Copy link
Copy Markdown
Contributor

pijyoi commented May 20, 2021

Huh. I'm just now noticing that I've been completely neglecting RawImageWidget, which uses makeARGB.

Well, RawImageWidget and RawImageGLWidget are not made any slower by this PR...

@outofculture
Copy link
Copy Markdown
Contributor Author

Agreed!

I was playing with refactors, but for now, this behaves well and looks good. Let's merge it!

@pijyoi
Copy link
Copy Markdown
Contributor

pijyoi commented May 20, 2021

Found an issue when using ImageView. To trigger it, run the below script and change the colormap by right-clicking on the HistogramLUTItem. It seems to have to do with HistogramLUTItem returning a Callable for self.lut.
https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/graphicsItems/ImageItem.py#L413

import pyqtgraph as pg
import cupy as xp

pg.setConfigOption('useCupy', True)

shape = (1024, 1024)
data_uint8 = xp.random.randint(256, size=shape, dtype=xp.uint8)
data_uint16 = xp.random.randint(4096, size=shape, dtype=xp.uint16)
data_float32 = xp.random.normal(size=shape)

pg.mkQApp()

imv = pg.ImageView()
imv.show()
imv.setImage(data_float32)

pg.exec()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants