Python pyqtgraph.RectROI() Examples
The following are 5
code examples of pyqtgraph.RectROI().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pyqtgraph
, or try the search function
.
Example #1
Source File: test_ROI.py From tf-pose with Apache License 2.0 | 7 votes |
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)
Example #2
Source File: tab_covariance.py From kite with GNU General Public License v3.0 | 6 votes |
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)
Example #3
Source File: picopyscope.py From picosdk-python-examples with ISC License | 6 votes |
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
Example #4
Source File: test_ROI.py From soapy with GNU General Public License v3.0 | 6 votes |
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)
Example #5
Source File: gui2p.py From suite2p with GNU General Public License v3.0 | 5 votes |
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