当前位置: 首页>>代码示例>>Python>>正文


Python pyqtgraph.ImageItem方法代码示例

本文整理汇总了Python中pyqtgraph.ImageItem方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.ImageItem方法的具体用法?Python pyqtgraph.ImageItem怎么用?Python pyqtgraph.ImageItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph的用法示例。


在下文中一共展示了pyqtgraph.ImageItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_plot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def update_plot(self, data_storage):
        """Update waterfall plot"""
        self.counter += 1

        # Create waterfall image on first run
        if self.counter == 1:
            self.waterfallImg = pg.ImageItem()
            self.waterfallImg.scale((data_storage.x[-1] - data_storage.x[0]) / len(data_storage.x), 1)
            self.plot.clear()
            self.plot.addItem(self.waterfallImg)

        # Roll down one and replace leading edge with new data
        self.waterfallImg.setImage(data_storage.history.buffer[-self.counter:].T,
                                   autoLevels=False, autoRange=False)

        # Move waterfall image to always start at 0
        self.waterfallImg.setPos(
            data_storage.x[0],
            -self.counter if self.counter < self.history_size else -self.history_size
        )

        # Link histogram widget to waterfall image on first run
        # (must be done after first data is received or else levels would be wrong)
        if self.counter == 1 and self.histogram_layout:
            self.histogram.setImageItem(self.waterfallImg) 
开发者ID:xmikos,项目名称:qspectrumanalyzer,代码行数:27,代码来源:plot.py

示例2: initialize_plot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def initialize_plot(self):
        
        self.viewBox = MyViewBox()
        self.viewBox.doubleclicked.connect(self.open_settings)
        self.viewBox.gain_zoom.connect(self.gain_zoom)
        self.viewBox.disableAutoRange()
        
        self.plot = pg.PlotItem(viewBox=self.viewBox)
        self.graphicsview.setCentralItem(self.plot)
        self.plot.hideButtons()
        
        self.image = pg.ImageItem()
        self.plot.addItem(self.image)
        
        self.curve_spike = pg.PlotCurveItem()
        self.plot.addItem(self.curve_spike)

        self.curve_limit = pg.PlotCurveItem()
        self.plot.addItem(self.curve_limit)
        
        self.change_lut() 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:23,代码来源:onlinewaveformhistviewer.py

示例3: initialize_plot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def initialize_plot(self):
        self.viewBox = MyViewBox()
        self.viewBox.doubleclicked.connect(self.open_settings)
        self.viewBox.disableAutoRange()
        
        self.plot = pg.PlotItem(viewBox=self.viewBox)
        self.graphicsview.setCentralItem(self.plot)
        self.plot.hideButtons()
        
        self.image = pg.ImageItem()
        self.plot.addItem(self.image)
        
        self.plot.hideAxis('bottom')
        self.plot.hideAxis('left')
        
        self._text_items = [] 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:18,代码来源:similarity.py

示例4: init

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def init(self, width, height):
        self.rect = QtCore.QRect(0, 0, width, height)
        self.imageItem = pg.ImageItem()
        self.imageItem.setImage(None)

        self.graphicsScene = pg.GraphicsScene()
        self.graphicsScene.addItem(self.imageItem)

        self.graphicsView = pg.GraphicsView()
        self.graphicsView.setRenderHint(QtGui.QPainter.Antialiasing)
        self.graphicsView.setScene(self.graphicsScene)

        layout = QtGui.QHBoxLayout()
        layout.addWidget(self.graphicsView)
        self.setLayout(layout)
        self.setMaximumSize(width, height)
        self.setMinimumSize(width-10, height-10) 
开发者ID:FabianIsensee,项目名称:BatchViewer,代码行数:19,代码来源:batchviewer.py

示例5: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def __init__(self, parent=None, *args, **kwargs):
        Renderer.__init__(self, *args, **kwargs)
        super().__init__(parent)
        self.ci.layout.setContentsMargins(0, 0, 0, 0)
        self.ci.layout.setSpacing(0)

        self.view = self.addViewBox()
        # self.view.setAspectLocked(True)
        self.view.setAspectLocked(lock=False)

        self.view.invertY(True)

        self.view.setContentsMargins(0, 0, 0, 0)

        self.img = pg.ImageItem(border='w')
        self.view.addItem(self.img)

        self.live_region = False

        if self.needs_region:
            self.setup_region()

        self.show() 
开发者ID:wapiflapi,项目名称:binglide,代码行数:25,代码来源:renderers.py

示例6: make_colorbar

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def make_colorbar(parent, b0):
    colorbarW = pg.GraphicsLayoutWidget(parent)
    colorbarW.setMaximumHeight(60)
    colorbarW.setMaximumWidth(150)
    colorbarW.ci.layout.setRowStretchFactor(0, 2)
    colorbarW.ci.layout.setContentsMargins(0, 0, 0, 0)
    parent.l0.addWidget(colorbarW, b0, 0, 1, 2)
    parent.colorbar = pg.ImageItem()
    cbar = colorbarW.addViewBox(row=0, col=0, colspan=3)
    cbar.setMenuEnabled(False)
    cbar.addItem(parent.colorbar)
    parent.clabel = [
        colorbarW.addLabel("0.0", color=[255, 255, 255], row=1, col=0),
        colorbarW.addLabel("0.5", color=[255, 255, 255], row=1, col=1),
        colorbarW.addLabel("1.0", color=[255, 255, 255], row=1, col=2),
    ] 
开发者ID:MouseLand,项目名称:suite2p,代码行数:18,代码来源:masks.py

示例7: run

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def run(self):
        app = QtGui.QApplication([])
        ## Create window with GraphicsView widget
        win = pg.GraphicsLayoutWidget()
        win.show()  ## show widget alone in its own window
        win.setWindowTitle('pyqtgraph example: ImageItem')
        view = win.addViewBox()

        ## lock the aspect ratio so pixels are always square
        view.setAspectLocked(True)

        ## Create image item
        self.img = pg.ImageItem(border='w')
        view.addItem(self.img)

        ## Set initial view bounds
        view.setRange(QtCore.QRectF(0, 0, 2*self.image_hw, self.image_hw))

        timer = QtCore.QTimer()
        timer.timeout.connect(self._update)
        timer.start(50)

        app.exec_() 
开发者ID:udacity,项目名称:RoboND-DeepLearning-Project,代码行数:25,代码来源:visualization.py

示例8: newColorbar

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def newColorbar(view, left, top, impixpervoxx, impixpervoxy, imgsize):
    cb_xdim = imgsize // 10
    cb_ydim = imgsize
    theviewbox = pg.ViewBox(enableMouse=False)
    theviewbox.setRange(QtCore.QRectF(0, 0, cb_xdim, cb_ydim),
                        xRange=(0, cb_xdim - 1), yRange=(0, cb_ydim - 1), padding=0.0,
                        disableAutoRange=True)
    theviewbox.setAspectLocked()

    thecolorbarwin = pg.ImageItem()
    theviewbox.addItem(thecolorbarwin)
    thecolorbarwin.translate(left, top)
    thecolorbarwin.scale(impixpervoxx, impixpervoxy)

    colorbarvals = np.zeros((cb_xdim, cb_ydim), dtype=np.float64)
    for i in range(0, cb_ydim):
        colorbarvals[:, i] = i * (1.0 / (cb_ydim - 1.0))
    thecolorbarwin.setImage(colorbarvals, levels=[0.0, 1.0])
    return thecolorbarwin, theviewbox 
开发者ID:bbfrederick,项目名称:rapidtide,代码行数:21,代码来源:OrthoImageItem.py

示例9: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def __init__(self, acc, n_points=300):
        super().__init__()
        self.title = "Tail curvature"
        self.acc = acc
        self.headers = None
        self.n_points = n_points

        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.display_widget = pg.GraphicsLayoutWidget()
        self.vb_display = pg.ViewBox()
        self.display_widget.addItem(self.vb_display)
        self.image_item = pg.ImageItem()
        self.vb_display.addItem(self.image_item)

        self.image_item.setLevels((-0.6, 0.6))
        self.image_item.setLookupTable(
            pg.ColorMap(
                np.linspace(0, 1, 5),
                np.array(
                    [
                        [0.42107294, 0.80737975, 0.49219722],
                        [0.23166242, 0.39962101, 0.32100403],
                        [0.0, 0.0, 0.0],
                        [0.46170494, 0.30327584, 0.38740225],
                        [0.91677407, 0.58427975, 0.92293321],
                    ]
                ),
            ).getLookupTable(alpha=False)
        )
        self.layout().addWidget(self.display_widget) 
开发者ID:portugueslab,项目名称:stytra,代码行数:34,代码来源:fishplots.py

示例10: __new_map_item

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def __new_map_item(z):
        map_item = ImageItem(autoLevels=False)
        map_item.setOpts(axisOrder='row-major')
        map_item.setZValue(z)
        return map_item 
开发者ID:biolab,项目名称:orange3-geo,代码行数:7,代码来源:plotutils.py

示例11: _update_map_item

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def _update_map_item(self):
        """Update ImageItem with current image."""
        self.map_item.setImage(np.array(self.map))
        self.map_item.setRect(self.ts_norm) 
开发者ID:biolab,项目名称:orange3-geo,代码行数:6,代码来源:plotutils.py

示例12: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def __init__(self, blockSize = 1024, samplingFreq = 250):
        super(SpectrogramWidget, self).__init__()

        self.blockSize = blockSize

        self.img = pg.ImageItem()
        self.addItem(self.img)

        self.img_array = np.zeros((100, (blockSize/2)+1))

        # bipolar colormap
        pos = np.array([0., 1., 0.5, 0.25, 0.75])
        color = np.array([[0,255,255,255], [255,255,0,255], [0,0,0,255], (0, 0, 255, 255), (255, 0, 0, 255)], dtype=np.ubyte)
        cmap = pg.ColorMap(pos, color)
        lut = cmap.getLookupTable(0.0, 1.0, 256)

        self.img.setLookupTable(lut)
        self.img.setLevels([-50,40])

        freq = np.arange((blockSize/2)+1)/(float(blockSize)/samplingFreq)
        yscale = 1.0/(self.img_array.shape[1]/freq[-1])
        self.img.scale((1./samplingFreq)*blockSize, yscale)

        self.setLabel('left', 'Frequency', units='Hz')

        self.win = np.hanning(blockSize)
        self.show()

        self.buffer = np.zeros(blockSize) 
开发者ID:strfry,项目名称:OpenNFB,代码行数:31,代码来源:SpectrogramWidget.py

示例13: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def __init__(self, name, **config):
        self.img = pg.ImageItem()
        self.plot_widget = pg.PlotWidget(title=name)
        self.plot_widget.block = self

        self.plot_widget.addItem(self.img)

        #self.img_array = np.zeros((1000, self.CHUNKSZ/2+1))
        self.img_array = np.zeros((1000, 48))

        # bipolar colormap
        pos = np.array([0., 1., 0.5, 0.25, 0.75])
        color = np.array([[0,255,255,255], [255,255,0,255], [0,0,0,255], (0, 0, 255, 255), (255, 0, 0, 255)], dtype=np.ubyte)
        cmap = pg.ColorMap(pos, color)
        lut = cmap.getLookupTable(0.0, 1.0, 256)

        self.img.setLookupTable(lut)
        self.img.setLevels([-2,7])

        FS = 48 * 2

        freq = np.arange((self.CHUNKSZ/2)+1)/(float(self.CHUNKSZ)/FS)
        yscale = 1.0/(self.img_array.shape[1]/freq[-1])
        self.img.scale((1./FS)*self.CHUNKSZ, yscale)

        self.plot_widget.setLabel('left', 'Frequency', units='Hz')

        self.win = np.hanning(self.CHUNKSZ)
        #self.show()
        super(Spectrograph, self).__init__(**config) 
开发者ID:strfry,项目名称:OpenNFB,代码行数:32,代码来源:display.py

示例14: init

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def init(self, name):
        self.name = name

        self.autoscale_button = QtGui.QCheckBox('Autoscale')
        self.autoscale_button.setCheckState(True)

        self.welch_button = QtGui.QCheckBox('Use Welch')
        self.welch_button.setCheckState(False)

        self.plot_widget = pg.PlotWidget(title=name)
        self.plot_widget.block = self

        self.plot_widget.setLabel('bottom', 'Frequency', units='Hz')
        self.plot_widget.setLabel("left", "Time", units='s')

        #TODO: listener for this
        #self.plot_widget.setYRange(-self.history_size / self.sampling_rate, 0)

        #self.plot_widget.setLimits(xMin=0, yMax=0)
        #self.plot_widget.showButtons()
        #self.waterfallPlotWidget.setAspectLocked(True)
        #self.waterfallPlotWidget.setDownsampling(mode="peak")
        #self.waterfallPlotWidget.setClipToView(True)
        
        # Setup histogram widget (for controlling waterfall plot levels and gradients)
        self.histogram = pg.PlotWidget(title='Histogram')
        self.waterfallHistogram = pg.HistogramLUTItem()
        self.histogram.addItem(self.waterfallHistogram)
        self.waterfallHistogram.gradient.loadPreset("flame")
        #self.waterfallHistogram.setHistogramRange(-50, 0)
        #self.waterfallHistogram.setLevels(-50, 0)

        self.waterfallImg = pg.ImageItem()
        self.plot_widget.clear()
        self.plot_widget.addItem(self.waterfallImg)      
        self.waterfallHistogram.setImageItem(self.waterfallImg)

        self.setup_range()

        self.update_counter = 0 
开发者ID:strfry,项目名称:OpenNFB,代码行数:42,代码来源:display.py

示例15: _add_image_to_layout

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ImageItem [as 别名]
def _add_image_to_layout(layout, row=None, col=None, rowspan=1, colspan=1, title=''):
    i = pg.ImageItem(border='w')
    i.setOpts(axisOrder='row-major')
    
    l = layout.addLayout()
    l.addLabel(title)
    l.nextRow()

    v = l.addViewBox(lockAspect=True, invertY=True, row=row, col=col, rowspan=rowspan, colspan=colspan)
    v.addItem(i)
    return {'img':i, 'view':v, 'layout':l} 
开发者ID:memo,项目名称:webcam-pix2pix-tensorflow,代码行数:13,代码来源:gui.py


注:本文中的pyqtgraph.ImageItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。