Update histogramlut example to allow rgb mode
This commit is contained in:
parent
bde358ffaf
commit
6e22524ac2
@ -28,19 +28,27 @@ v = pg.GraphicsView()
|
|||||||
vb = pg.ViewBox()
|
vb = pg.ViewBox()
|
||||||
vb.setAspectLocked()
|
vb.setAspectLocked()
|
||||||
v.setCentralItem(vb)
|
v.setCentralItem(vb)
|
||||||
l.addWidget(v, 0, 0)
|
l.addWidget(v, 0, 0, 3, 1)
|
||||||
|
|
||||||
w = pg.HistogramLUTWidget()
|
w = pg.HistogramLUTWidget()
|
||||||
l.addWidget(w, 0, 1)
|
l.addWidget(w, 0, 1)
|
||||||
|
|
||||||
data = pg.gaussianFilter(np.random.normal(size=(256, 256)), (20, 20))
|
monoRadio = QtGui.QRadioButton('mono')
|
||||||
|
rgbaRadio = QtGui.QRadioButton('rgba')
|
||||||
|
l.addWidget(monoRadio, 1, 1)
|
||||||
|
l.addWidget(rgbaRadio, 2, 1)
|
||||||
|
monoRadio.setChecked(True)
|
||||||
|
|
||||||
|
def setLevelMode():
|
||||||
|
mode = 'mono' if monoRadio.isChecked() else 'rgba'
|
||||||
|
w.setLevelMode(mode)
|
||||||
|
monoRadio.toggled.connect(setLevelMode)
|
||||||
|
|
||||||
|
data = pg.gaussianFilter(np.random.normal(size=(256, 256, 3)), (20, 20, 0))
|
||||||
for i in range(32):
|
for i in range(32):
|
||||||
for j in range(32):
|
for j in range(32):
|
||||||
data[i*8, j*8] += .1
|
data[i*8, j*8] += .1
|
||||||
img = pg.ImageItem(data)
|
img = pg.ImageItem(data)
|
||||||
#data2 = np.zeros((2,) + data.shape + (2,))
|
|
||||||
#data2[0,:,:,0] = data ## make non-contiguous array for testing purposes
|
|
||||||
#img = pg.ImageItem(data2[0,:,:,0])
|
|
||||||
vb.addItem(img)
|
vb.addItem(img)
|
||||||
vb.autoRange()
|
vb.autoRange()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user