Python pyqtgraph 模块,ImageItem() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用pyqtgraph.ImageItem()

项目:ANNarchy    作者:vitay    | 项目源码 | 文件源码
def __init__(self, video, result):
        self.video = video
        self.result = result
        app = pg.mkQApp()
        self.win = pg.GraphicsWindow(title="Live webcam")
        self.win.resize(640,480)   

        box = self.win.addViewBox(lockAspect=True)
        box.invertY()
        self.vis = pg.ImageItem()
        box.addItem(self.vis)  

        box = self.win.addViewBox(lockAspect=True)
        box.invertY()
        self.res = pg.ImageItem()
        box.addItem(self.res)  

        self.win.show()

        self.lastUpdate = pg.ptime.time()
        self.avgFps = 0.0
项目:CElegansBehaviour    作者:ChristophKirst    | 项目源码 | 文件源码
def __init__(self, data, title = None, color = 'viridis', ncolors = None):
    #self.app = pg.QtGui.QApplication([])
    #self.win = pg.GraphicsLayoutWidget()
    #self.win.resize(1200, 800)
    lut = colormap_lut(color, ncolors);

    self.img = pg.ImageItem()
    self.img.setLookupTable(lut)
    self.img.setLevels([0,1])        

    #self.plot = self.win.addPlot()
    self.plot = pg.plot(title = title);
    self.plot.addItem(self.img)

    #self.timer = QtCore.QTimer()
    #self.timer.timeout.connect(self.check_for_new_data_and_replot)
    #self.timer.start(100)
    self.img.setImage(data.T)
    #self.win.show()
项目:CElegansBehaviour    作者:ChristophKirst    | 项目源码 | 文件源码
def __init__(self, data, title = None, color = 'viridis', ncolors = None):
    #self.app = pg.QtGui.QApplication([])
    #self.win = pg.GraphicsLayoutWidget()
    #self.win.resize(1200, 800)
    lut = colormap_lut(color, ncolors);

    self.img = pg.ImageItem()
    self.img.setLookupTable(lut)
    self.img.setLevels([0,1])        

    #self.plot = self.win.addPlot()
    self.plot = pg.plot(title = title);
    self.plot.addItem(self.img)

    #self.timer = QtCore.QTimer()
    #self.timer.timeout.connect(self.check_for_new_data_and_replot)
    #self.timer.start(100)
    self.img.setImage(data.T)
    #self.win.show()
项目:uavClassification    作者:BENR0    | 项目源码 | 文件源码
def __init__(self, parent=None):
        #pyqtgraph.setConfigOptions(imageAxisOrder='row-major')
        super(self.__class__, self).__init__()
        self.setupUi(self)
        self.slider_spatialr.valueChanged.connect(self.runSegment)
        self.slider_ranger.valueChanged.connect(self.runSegment)
        self.slider_classes.valueChanged.connect(self.runClassification)
        self.imageItem = pyqtgraph.ImageItem()
        self.view = pyqtgraph.ViewBox()
        self.view.addItem(self.imageItem)
        #segResult is of class pyqtgraph.GraphicsView
        self.segResult.setCentralItem(self.view)

        #get file pathes with buttons
        self.RGBimgpathButton.clicked.connect(self.getFileRGB)
        self.smoothedpathButton.clicked.connect(self.getFilesmoothed)
        self.saveClassificationButton.clicked.connect(self.saveFileClassified)

        #temporary data of segmented image
        self.segmentedout = "data/app_segmented.tif"
        self.RGBimgpath = "data/test_image_cubic_resample.tif" 
        self.smoothedpath = "data/smoothed.tif"
项目:ScopeFoundry    作者:ScopeFoundry    | 项目源码 | 文件源码
def update_display(self):
        #self.log.debug('update_display')
        if self.initial_scan_setup_plotting:
            if self.settings['show_previous_scans']:
                self.img_item = pg.ImageItem()
                self.img_items.append(self.img_item)
                self.img_plot.addItem(self.img_item)
                self.hist_lut.setImageItem(self.img_item)

            self.img_item.setImage(self.display_image_map[0,:,:])
            x0, x1, y0, y1 = self.imshow_extent
            self.log.debug('update_display set bounds {} {} {} {}'.format(x0, x1, y0, y1))
            self.img_item_rect = QtCore.QRectF(x0, y0, x1-x0, y1-y0)
            self.img_item.setRect(self.img_item_rect)
            self.log.debug('update_display set bounds {}'.format(self.img_item_rect))

            self.initial_scan_setup_plotting = False
        else:
            #if self.settings.scan_type.val in ['raster']
            kk, jj, ii = self.current_scan_index
            self.disp_img = self.display_image_map[kk,:,:].T
            self.img_item.setImage(self.disp_img, autoRange=False, autoLevels=False)
            self.img_item.setRect(self.img_item_rect) # Important to set rectangle after setImage for non-square pixels
            self.update_LUT()
项目:ANNarchy    作者:vitay    | 项目源码 | 文件源码
def __init__(self, func):

        self.func = func

        app = pg.mkQApp()
        self.win = pg.GraphicsWindow(title="Bar learning")
        self.win.resize(800,800)
        self.win.addLabel("Input")
        self.win.addLabel("Feature")
        self.win.nextRow()

        box = self.win.addViewBox(lockAspect=True)
        self.input_vis = pg.ImageItem()
        box.addItem(self.input_vis)

        box = self.win.addViewBox(lockAspect=True)
        self.feature_vis = pg.ImageItem()
        box.addItem(self.feature_vis)
        self.win.nextRow()

        self.win.addLabel("Receptive fields", colspan=2)
        self.win.nextRow()
        box = self.win.addViewBox(lockAspect=True, colspan=2)
        self.rv_vis = pg.ImageItem()
        box.addItem(self.rv_vis)

        self.win.show()
项目:Traffic    作者:The-traffic-team    | 项目源码 | 文件源码
def __init__(self):
        self._backgroundImage = "../roadlanes.png"
        self._roadLength = 5e4
        self._roadWidth = self._roadLength  * 663./1657
    self._laneWidth = self._roadWidth / 4.
        self._trafficManager = None
        self._pw = pg.plot(pen='y', symbol='t', symbolSize=200)
    x = Image.open('../roadlanes.png')
    im = np.array(x)

        self._backgroundImage = pg.ImageItem(im, autoDownsample = True, autoLevels = False)
项目:kite    作者:pyrocko    | 项目源码 | 文件源码
def __init__(self, sandbox, component, title='Untitled'):
        pg.PlotItem.__init__(self)
        self.title = title
        self.sandbox = sandbox
        self.component = component

        self.cursor = CursorRect()
        self.addCursor()

        self.setAspectLocked(True)
        self.setLabels(
            bottom=('Easting', 'm'),
            left=('Northing', 'm'))

        self.image = pg.ImageItem(
            None,
            autoDownsample=False,
            useOpenGL=True)
        self.addItem(self.image)

        self.title_label = pg.LabelItem(
            text='<span style="color: #9E9E9E;">'
                 '%s</span>' % self.title,
            justify='right', size='10pt',
            parent=self)
        self.title_label.anchor(
            itemPos=(0., 0.),
            parentPos=(.01, .01))
        self.title_label.setOpacity(.6)

        self.sandbox.sigModelUpdated.connect(
            self.update)
        self.sandbox.sources.modelAboutToBeReset.connect(
            self.removeSourceROIS)
        self.sandbox.sources.modelReset.connect(
            self.addSourceROIS)

        self.update()
        self.rois = []
        self.addSourceROIS()
项目:kite    作者:pyrocko    | 项目源码 | 文件源码
def __init__(self, model, los_arrow=False):
        pg.PlotWidget.__init__(self)
        self.model = model
        self.draw_time = 0.
        self._data = None

        border_pen = pg.mkPen(255, 255, 255, 50)
        self.image = pg.ImageItem(
            None,
            autoDownsample=False,
            border=border_pen,
            useOpenGL=True)

        self.setAspectLocked(True)
        self.plotItem.getAxis('left').setZValue(100)
        self.plotItem.getAxis('bottom').setZValue(100)
        self.setLabels(
            bottom=('Easting', 'm'),
            left=('Northing', 'm'))

        self.hint = {
            'east': 0.,
            'north': 0.,
            'value': num.nan,
            'measure': self.component.title(),
            'vlength': '03',
            'precision': '3',
        }

        self.hint_text = pg.LabelItem(
            text='',
            justify='right', size='8pt',
            parent=self.plotItem)
        self.hint_text.anchor(
            itemPos=(1., 0.),
            parentPos=(1., 0.))
        self.hint_text.text_template =\
            '<span style="font-family: monospace; color: #fff;'\
            'background-color: #000;">'\
            'East {east:08.2f} m | North {north:08.2f} m | '\
            '{measure} {value:{length}.{precision}f}</span>'
        self.hint_text.setOpacity(.6)

        self.addItem(self.image)
        self.update()

        self.transFromFrame()
        self._move_sig = pg.SignalProxy(
            self.image.scene().sigMouseMoved,
            rateLimit=25, slot=self.mouseMoved)

        if los_arrow:
            self.addLOSArrow()

        # self.addIsocurve()
        # self.scalebar()