hide 'ROI' and 'Norm' buttons

1,138 views
Skip to first unread message

Karl Bedrich

unread,
May 31, 2013, 9:48:47 AM5/31/13
to pyqt...@googlegroups.com
hey luke,

is there an easy way to hide the 'ROI' and 'Norm' buttons of the imageView (for example if you want to export the scene)?

is it possible to hide the histogramm and only to show the labeled colorbar (similar to the matpoltlib-images)?


...many questions today


tanks and best whishes,
karl

Luke Campagnola

unread,
May 31, 2013, 10:43:22 AM5/31/13
to pyqt...@googlegroups.com
On Fri, May 31, 2013 at 9:48 AM, Karl Bedrich <karlgeor...@gmail.com> wrote:
hey luke,

is there an easy way to hide the 'ROI' and 'Norm' buttons of the imageView (for example if you want to export the scene)?

Well there's a very direct way:

     imageview.ui.roiBtn.hide()
     imageview.ui.normBtn.hide()

.. but I should probably wrap these in a method. 
 
is it possible to hide the histogramm and only to show the labeled colorbar (similar to the matpoltlib-images)?

This is more tricky; I should definitely add a method for this.

However: ImageView is a very high-level widget. If all you really want is an image with basic color control, it might be easier to build this from the ground-up rather than trying to simplify ImageView:

import pyqtgraph as pg
pg.mkQApp()

win = pg.GraphicsLayoutWidget()
vb = win.addViewBox()
vb.setAspectLocked()
grad = pg.GradientEditorItem(orientation='right')
win.addItem(grad, 0, 1)
img = pg.ImageItem()
vb.addItem(img)
win.show()

def update():
    lut = grad.getLookupTable(512)
    img.setLookupTable(lut)
grad.sigGradientChanged.connect(update)

import numpy as np
img.setImage(np.random.normal(size=(100,100)))

This example has the added benefit that the image and gradient are in the same scene and thus can be exported together.


Luke

Reply all
Reply to author
Forward
0 new messages