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


Python pyqtgraph.ROI属性代码示例

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


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

示例1: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def __init__(self, gitem, **params):
        ParamObj.__init__(self)
        pg.GraphicsObject.__init__(self) #, [0,0], [1,1])

        self.gitem = gitem
        self.surfaces = gitem.surfaces
        gitem.setParentItem(self)
        
        self.roi = pg.ROI([0,0], [1,1])
        self.roi.addRotateHandle([1, 1], [0.5, 0.5])
        self.roi.setParentItem(self)
        
        defaults = {
            'pos': Point(0,0),
            'angle': 0,
        }
        defaults.update(params)
        self._ior_cache = {}
        self.roi.sigRegionChanged.connect(self.roiChanged)
        self.setParams(**defaults) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:22,代码来源:pyoptic.py

示例2: paramStateChanged

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def paramStateChanged(self):
        """Some parameters of the optic have changed."""
        # Move graphics item
        self.gitem.setPos(Point(self['pos']))
        self.gitem.resetTransform()
        self.gitem.rotate(self['angle'])
        
        # Move ROI to match
        try:
            self.roi.sigRegionChanged.disconnect(self.roiChanged)
            br = self.gitem.boundingRect()
            o = self.gitem.mapToParent(br.topLeft())
            self.roi.setAngle(self['angle'])
            self.roi.setPos(o)
            self.roi.setSize([br.width(), br.height()])
        finally:
            self.roi.sigRegionChanged.connect(self.roiChanged)
        
        self.sigStateChanged.emit() 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:21,代码来源:pyoptic.py

示例3: test_getArrayRegion

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def test_getArrayRegion(transpose=False):
    pr = pg.PolyLineROI([[0, 0], [27, 0], [0, 28]], closed=True)
    pr.setPos(1, 1)
    rois = [
        (pg.ROI([1, 1], [27, 28], pen='y'), 'baseroi'),
        (pg.RectROI([1, 1], [27, 28], pen='y'), 'rectroi'),
        (pg.EllipseROI([1, 1], [27, 28], pen='y'), 'ellipseroi'),
        (pr, 'polylineroi'),
    ]
    for roi, name in rois:
        # For some ROIs, resize should not be used.
        testResize = not isinstance(roi, pg.PolyLineROI)
        
        origMode = pg.getConfigOption('imageAxisOrder')
        try:
            if transpose:
                pg.setConfigOptions(imageAxisOrder='row-major')
                check_getArrayRegion(roi, 'roi/'+name, testResize, transpose=True)
            else:
                pg.setConfigOptions(imageAxisOrder='col-major')
                check_getArrayRegion(roi, 'roi/'+name, testResize)
        finally:
            pg.setConfigOptions(imageAxisOrder=origMode) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:25,代码来源:test_ROI.py

示例4: plot_histogram_raxis

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def plot_histogram_raxis(self, vals, bins):
        """
        Plots histogram to the right axis.

        :param vals: (list or numpy array) List of valley values of histogram.
        :param bins: (list or numpy array) List of bins values of histogram in Hz
        """

        # shadow pen is the properties of shadow around the lines
        self.right_axis.plot(x=vals, y=bins, shadowPen=SHADOW_PEN)
        self.right_axis.setXRange(0, np.max(vals), padding=0)

        # cursor in the histogram plot.
        self.hline_histogram = pg.ROI(pos=[0, 0], size=[0, 1], angle=-90,
                                      pen=CURSOR_PEN)
        self.right_axis.addItem(self.hline_histogram)

        # Link the y-axises of pitch and histogram plots
        self.zoom_selection.setYLink(self.right_axis) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:21,代码来源:timeserieswidget.py

示例5: update_notes

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def update_notes(self, xmin, xmax):
        """
        Plots the note squares on the time series widget according to the given region.

        :param xmin: (int) Minimum value of the region selector item
        :param xmax: (int) Maximum value of the region selector item
        """
        pen=(225, 224, 181, 175)
        start_ind = self.find_nearest_index(self.notes_start, xmin)
        end_ind = self.find_nearest_index(self.notes_end, xmax)

        self.remove_given_items(self.zoom_selection, self.rois)
        self.rois = []

        for i in range(start_ind, end_ind):
            temp_note = self.notes[i]
            roi = pg.ROI(pos=[temp_note[0], temp_note[2]],
                         size=[temp_note[1] - temp_note[0], 5], pen=pen)
            roi.addScaleHandle(pos=[0, 0], center=[0.5, 0.5])
            roi.addScaleHandle(pos=[1, 1], center=[0.5, 0.5])
            self.zoom_selection.addItem(roi)
            self.rois.append(roi) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:24,代码来源:timeserieswidget.py

示例6: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)

        # Draw ROI for tail selection:
        self.tail_params = self.experiment.pipeline.tailtrack._params
        self.roi_tail = SingleLineROI(
            self.tail_points(), pen=dict(color=(40, 5, 200), width=3)
        )

        # Prepare curve for plotting tracked tail position:
        self.curve_tail = pg.PlotCurveItem(pen=dict(color=(230, 40, 5), width=3))
        self.display_area.addItem(self.curve_tail)

        self.initialise_roi(self.roi_tail)

        self.setting_param_val = False 
开发者ID:portugueslab,项目名称:stytra,代码行数:19,代码来源:camera_display.py

示例7: __set_plot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def __set_plot(self):
        self.hist_widget.setMouseEnabled(x=False, y=False)
        self.hist_widget.setMenuEnabled(False)

        self.hline_histogram = pg.ROI(pos=[0, 0], size=[0, self.max_val], angle=0,
                                      pen=CURSOR_PEN)
        self.hist_widget.addItem(self.hline_histogram) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:9,代码来源:histogram.py

示例8: __add_items_to_plot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def __add_items_to_plot(self, len_plot, min_audio, max_audio):
        """
        Adds a region selector item and vertical line for to the waveform plot.

        :param len_plot: (int) Number of samples in plotted waveform array.
        :param min_audio: (float) The minimum value of plotted waveform array.
        :param max_audio: (float) The maximum value of plotted waveform array.
        """

        # Create a waveform region item and add it to waveform plot
        pos_wf_x_max = len_plot * 0.05  # Region item focuses on the 5% of
        # waveform plot.
        self.region_wf = WaveformRegionItem(values=[0, pos_wf_x_max],
                                            brush=WAVEFORM_BRUSH,
                                            bounds=[0., len_plot])

        # Creating a cursor with pyqtgraph.ROI
        self.vline_wf = pg.ROI(pos=[0, min_audio],
                               size=[0, max_audio - min_audio],
                               angle=0, pen=WAVEFORM_VLINE)

        # add items to waveform plot
        self.waveform.addItem(self.region_wf)
        self.waveform.addItem(self.vline_wf)

        # text item
        self.section_label = pg.TextItem(text='')
        self.waveform.addItem(self.section_label) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:30,代码来源:waveformwidget.py

示例9: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def __init__(self, delegate):
        self.delegate = delegate
        self.source = self.delegate.source
        source = self.source

        pg.ROI.__init__(
            self,
            pos=pg.Point(source.outline()[1]),
            size=pg.Point(source.width, source.length),
            angle=-source.strike,
            invertible=False,
            pen=self.pen_outline)
        self.handlePen = self.pen_handle

        self.addScaleRotateHandle([0, 0], [0, 1])
        self.addScaleRotateHandle([0, 1], [0, 0])
        self.addScaleHandle([1, .5], [0, .5],
                            lockAspect=False)

        for h in self.handles:
            h['item'].sigClicked.connect(self.sigRegionChangeStarted.emit)

        self.delegate.sourceParametersChanged.connect(
            self.updateROIPosition)
        self.sigRegionChangeFinished.connect(
            self.setSourceParametersFromROI)

        self.setAcceptedMouseButtons(QtCore.Qt.RightButton)
        self.sigClicked.connect(self.showEditingDialog) 
开发者ID:pyrocko,项目名称:kite,代码行数:31,代码来源:base.py

示例10: _makePen

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def _makePen(self):
        # Generate the pen color for this ROI based on its current state.
        if self.mouseHovering:
            return self.pen_highlight
        else:
            return self.pen 
开发者ID:pyrocko,项目名称:kite,代码行数:8,代码来源:base.py

示例11: initialise_roi

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def initialise_roi(self, roi):
        """ROI is initialised separately, so it can first be defined in the
        child __init__.

        Parameters
        ----------

        Returns
        -------

        """
        # Add ROI to image and connect it to the function for updating
        # the relative params:
        self.display_area.addItem(roi)
        roi.sigRegionChanged.connect(self.set_pos_from_roi) 
开发者ID:portugueslab,项目名称:stytra,代码行数:17,代码来源:camera_display.py

示例12: set_pos_from_tree

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def set_pos_from_tree(self):
        """Called when ROI position values are changed in the ParameterTree.
        Change the position of the displayed ROI.

        Parameters
        ----------

        Returns
        -------

        """
        pass 
开发者ID:portugueslab,项目名称:stytra,代码行数:14,代码来源:camera_display.py

示例13: set_pos_from_roi

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def set_pos_from_roi(self):
        """Called when ROI position values are changed in the displayed ROI.
        Change the position in the ParameterTree values.

        Parameters
        ----------

        Returns
        -------

        """
        pass 
开发者ID:portugueslab,项目名称:stytra,代码行数:14,代码来源:camera_display.py

示例14: add_1d_view

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def add_1d_view(self):
        """
        Adds a 1d view to TimeSeriesWidget where you can plot and add items on it.
        """

        # To customize the plot axises, create new ones.
        x_axis = pg.AxisItem('bottom')  # x-axis
        x_axis.enableAutoSIPrefix(enable=False)  # Prevent automatic SI
        # prefix scaling on this axis.
        x_axis.setGrid(100)  # the alpha value of grids on x-axis

        y_axis = pg.AxisItem('left')  # x-axis
        y_axis.enableAutoSIPrefix(enable=False)  # Prevent automatic SI
        # prefix scaling on this axis.
        axis_items = {'left': y_axis, 'bottom': x_axis}

        # add plot
        self.zoom_selection = self.centralWidget.addPlot(axisItems=axis_items)

        # disable the mouse events and menu events
        self.zoom_selection.setMouseEnabled(x=False, y=False)
        self.zoom_selection.setMenuEnabled(False)

        # initialize a cursor object. Height of cursor is 20000.
        self.vline = pg.ROI(pos=[0, 0], size=[0, 20000], angle=0,
                            pen=CURSOR_PEN)
        self.zoom_selection.addItem(self.vline)  # add item to plot area

        # add y-axis region
        self.right_axis = self.centralWidget.addPlot(row=0, col=1)

        # disable the mouse events and menu events
        self.right_axis.setMouseEnabled(x=False, y=False)
        self.right_axis.setMenuEnabled(False)

        self.right_axis.setMaximumWidth(125)  # maximum width 125
        self.right_axis.setContentsMargins(0, 0, 0, 40)  # set 40 left margin

        self.right_axis.hideAxis(axis="left")  # hide left-axis
        self.right_axis.hideAxis(axis="bottom")  # hide botton-axis
        self.right_axis.setYRange(0, 20000, padding=0)
        # show right axis
        self.right_axis.setLabel(axis="right", text="Frequency (Hz)")

        # initialize a linear region item
        orientation = pg.LinearRegionItem.Horizontal  # set the item horizontal
        self.region_yaxis = pg.LinearRegionItem(values=[0, 20000],
                                                brush=YAXIS_BRUSH,
                                                orientation=orientation,
                                                bounds=[0, 20000])
        self.right_axis.addItem(self.region_yaxis)  # add item to right axis

        # set region changed signal to set y axis range in the plot
        self.region_yaxis.sigRegionChangeFinished.connect(
            self.change_yaxis_range) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:57,代码来源:timeserieswidget.py

示例15: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ROI [as 别名]
def __init__(self, *args, display_size=(1280, 800), display, **kwargs):
        super().__init__(*args, **kwargs)

        self.display = display

        self.view_box = pg.ViewBox(invertY=True, lockAspect=1, enableMouse=False)
        self.addItem(self.view_box)

        self.roi_box = pg.ROI(
            maxBounds=QRectF(0, 0, display_size[0], display_size[1]),
            size=display.size,
            pos=display.pos,
        )

        self.roi_box.addScaleHandle([0, 0], [1, 1])
        self.roi_box.addScaleHandle([1, 1], [0, 0])
        self.roi_box.sigRegionChanged.connect(self.set_param_val)
        self.display.sig_param_changed.connect(self.set_roi)
        self.view_box.addItem(self.roi_box)
        self.view_box.setRange(
            QRectF(0, 0, display_size[0], display_size[1]),
            update=True,
            disableAutoRange=True,
        )
        self.view_box.addItem(
            pg.ROI(
                pos=(1, 1),
                size=(display_size[0] - 1, display_size[1] - 1),
                movable=False,
                pen=(80, 80, 80),
            )
        )

        self.calibration_points = pg.ScatterPlotItem(pen=(255, 0, 0), brush=None)
        self.calibration_frame = pg.PlotCurveItem(
            brush=(120, 10, 10), pen=(200, 10, 10), fill_level=1
        )

        self.camera_image = pg.ImageItem()

        self.view_box.addItem(self.calibration_frame)
        self.view_box.addItem(self.camera_image)
        self.view_box.addItem(self.calibration_points)

        self.setting_param_val = False

        self.set_param_val() 
开发者ID:portugueslab,项目名称:stytra,代码行数:49,代码来源:monitor_control.py


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