本文整理汇总了Python中pyqtgraph.RectROI方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.RectROI方法的具体用法?Python pyqtgraph.RectROI怎么用?Python pyqtgraph.RectROI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph
的用法示例。
在下文中一共展示了pyqtgraph.RectROI方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getArrayRegion
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import RectROI [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)
示例2: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import RectROI [as 别名]
def __init__(self, model):
sp = model
_, _, sizeE, sizeN = sp.covariance.noise_coord
self.patch_size_roi = pg.RectROI(
pos=(0., 0.),
size=(sizeE, sizeN),
sideScalers=True,
movable=False,
pen=pen_roi)
self._anisotropic = False
self.components_available = {
'synthetic_noise': [
'Noise',
lambda sp: sp.covariance.syntheticNoise(
self.sizePatchPx(), anisotropic=self.anisotropic)
]}
self._component = 'synthetic_noise'
KitePlot.__init__(self, model=model)
self.patch_size_roi.sigRegionChangeFinished.connect(self.update)
self.addItem(self.patch_size_roi)
示例3: triggerKnobEnabledChange
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import RectROI [as 别名]
def triggerKnobEnabledChange(self, state):
self.triggerKnobSource.setEnabled(state)
self.triggerKnobDirection.setEnabled(state)
if state:
if self.triggX is None:
self.triggX = 0.5
if self.triggY is None:
self.triggY = 0
if self.triggerDiamond is None:
self.triggerDiamond = pg.RectROI([self.triggX * self.samples / self.ratioBin, self.triggY],
[0, 0], invertible=True, pen=pg.mkPen(None))
self.triggerDiamond.sigRegionChanged.connect(self.triggerDiamondUpdate)
self.viewPlot.addItem(self.triggerDiamond)
else:
self.viewPlot.removeItem(self.triggerDiamond)
self.triggerDiamond = None
self.triggerReset = True
示例4: ROI_selection
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import RectROI [as 别名]
def ROI_selection(self):
draw = False
if self.sizebtns.button(0).isChecked():
wplot = 0
view = self.p1.viewRange()
draw = True
elif self.sizebtns.button(2).isChecked():
wplot = 1
view = self.p2.viewRange()
draw = True
if draw:
self.ROI_remove()
self.topbtns.button(0).setStyleSheet(self.stylePressed)
self.ROIplot = wplot
imx = (view[0][1] + view[0][0]) / 2
imy = (view[1][1] + view[1][0]) / 2
dx = (view[0][1] - view[0][0]) / 4
dy = (view[1][1] - view[1][0]) / 4
dx = np.minimum(dx, 300)
dy = np.minimum(dy, 300)
imx = imx - dx / 2
imy = imy - dy / 2
self.ROI = pg.RectROI(
[imx, imy], [dx, dy],
pen="w", sideScalers=True
)
if wplot == 0:
self.p1.addItem(self.ROI)
else:
self.p2.addItem(self.ROI)
self.ROI_position()
self.ROI.sigRegionChangeFinished.connect(self.ROI_position)
self.isROI = True