Esempio n. 1
0
 def __init__(self, parent=None, **kargs):
     RawImageWidget.__init__(self, parent=parent, scaled=True)
     super(QWidget, self).__init__(parent)
     self.setWindowTitle("image")
     self.rubberBand = QRubberBand(QRubberBand.Rectangle, self)
     self.mousePressPosition = QPoint(0, 0)
     self.mouseReleasePosition = QPoint(0, 0)
     self.clientCallback = None
     self.mousePressed = False
     self.okToClose = False
     self.setGeometry(QRect(10, 300, 600, 600))
Esempio n. 2
0
 def create_QtPlotter(self):
     self.RAW = 1
     if self.RAW:
         self.win = QtGui.QMainWindow()
         self.win.resize(400, 400)
         self.rawImg = RawImageWidget(self.win, scaled=True)
         self.win.setCentralWidget(self.rawImg)
         self.win.show()
     else:
         self.win = pg.GraphicsLayoutWidget()
         self.win.show()
         self.win.setWindowTitle("TART2 - Live View")
         view = self.win.addViewBox()
         view.setAspectLocked(True)
         self.img = pg.ImageItem(border="w")
         view.addItem(self.img)
     self.timer = QtCore.QTimer()
     self.timer.timeout.connect(self.update)
     self.timer.start(0)
     self.q = Queue()
Esempio n. 3
0
 def __init__(self, parent=None):
     # initialization of Qt MainWindow widget
     super(VideoWidget, self).__init__(parent)
     # set the "canvas" to the RawImage widget
     self.rawImg = RawImageWidget(QWidget())
     # create a vertical box layout
     self.vbl = QVBoxLayout()
     # add widget to vertical box
     self.vbl.addWidget(self.rawImg)
     # set the layout to the vertical box
     self.setLayout(self.vbl)
Esempio n. 4
0
def main():
    global app, img, x, y, MAX_FRAMES
    global args

    parser = argparse.ArgumentParser(description='AreaDetector video example')

    parser.add_argument(
        "ImagePV", help="EPICS PVA image PV name, such as 13PG2:Pva1:Image")
    parser.add_argument('--benchmark',
                        action='store_true',
                        help='measure framerate')
    parser.add_argument('--noAGC',
                        action='store_true',
                        help='disable auto gain')
    parser.add_argument('--frames',
                        action='store_true',
                        help='maximum number of frames (-1: unlimited)')

    args = parser.parse_args()

    app = QtGui.QApplication([])
    win = QtWidgets.QWidget()
    win.setWindowTitle('daqScope')
    layout = QtGui.QGridLayout()
    layout.setMargin(0)
    win.setLayout(layout)
    img = RawImageWidget(win)
    layout.addWidget(img, 0, 0, 0, 0)
    win.show()
    chan = pvaccess.Channel(args.ImagePV)

    x, y = chan.get('field()')['dimension']
    x = x['size']
    y = y['size']
    win.resize(x, y)

    chan.subscribe('update', update)
    chan.startMonitor()

    if args.benchmark:
        start = time.time()

    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
        chan.stopMonitor()
        chan.unsubscribe('update')

    if args.benchmark:
        stop = time.time()
        print('Frames displayed: %d' % framesDisplayed)
        print('Elapsed time:     %.3f sec' % (stop - start))
        print('Frames per second: %.3f FPS' % (framesDisplayed /
                                               (stop - start)))
Esempio n. 5
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(695, 798)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.downsampleCheck = QtGui.QCheckBox(self.centralwidget)
        self.downsampleCheck.setObjectName("downsampleCheck")
        self.gridLayout_2.addWidget(self.downsampleCheck, 8, 0, 1, 2)
        self.scaleCheck = QtGui.QCheckBox(self.centralwidget)
        self.scaleCheck.setObjectName("scaleCheck")
        self.gridLayout_2.addWidget(self.scaleCheck, 4, 0, 1, 1)
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.rawRadio = QtGui.QRadioButton(self.centralwidget)
        self.rawRadio.setObjectName("rawRadio")
        self.gridLayout.addWidget(self.rawRadio, 3, 0, 1, 1)
        self.gfxRadio = QtGui.QRadioButton(self.centralwidget)
        self.gfxRadio.setChecked(True)
        self.gfxRadio.setObjectName("gfxRadio")
        self.gridLayout.addWidget(self.gfxRadio, 2, 0, 1, 1)
        self.stack = QtGui.QStackedWidget(self.centralwidget)
        self.stack.setObjectName("stack")
        self.page = QtGui.QWidget()
        self.page.setObjectName("page")
        self.gridLayout_3 = QtGui.QGridLayout(self.page)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.graphicsView = GraphicsView(self.page)
        self.graphicsView.setObjectName("graphicsView")
        self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 1)
        self.stack.addWidget(self.page)
        self.page_2 = QtGui.QWidget()
        self.page_2.setObjectName("page_2")
        self.gridLayout_4 = QtGui.QGridLayout(self.page_2)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.rawImg = RawImageWidget(self.page_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.rawImg.sizePolicy().hasHeightForWidth())
        self.rawImg.setSizePolicy(sizePolicy)
        self.rawImg.setObjectName("rawImg")
        self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1)
        self.stack.addWidget(self.page_2)
        self.gridLayout.addWidget(self.stack, 0, 0, 1, 1)
        self.rawGLRadio = QtGui.QRadioButton(self.centralwidget)
        self.rawGLRadio.setObjectName("rawGLRadio")
        self.gridLayout.addWidget(self.rawGLRadio, 4, 0, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 4)
        self.dtypeCombo = QtGui.QComboBox(self.centralwidget)
        self.dtypeCombo.setObjectName("dtypeCombo")
        self.dtypeCombo.addItem("")
        self.dtypeCombo.addItem("")
        self.dtypeCombo.addItem("")
        self.gridLayout_2.addWidget(self.dtypeCombo, 3, 2, 1, 1)
        self.label = QtGui.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout_2.addWidget(self.label, 3, 0, 1, 1)
        self.rgbLevelsCheck = QtGui.QCheckBox(self.centralwidget)
        self.rgbLevelsCheck.setObjectName("rgbLevelsCheck")
        self.gridLayout_2.addWidget(self.rgbLevelsCheck, 4, 1, 1, 1)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.minSpin2 = SpinBox(self.centralwidget)
        self.minSpin2.setEnabled(False)
        self.minSpin2.setObjectName("minSpin2")
        self.horizontalLayout_2.addWidget(self.minSpin2)
        self.label_3 = QtGui.QLabel(self.centralwidget)
        self.label_3.setAlignment(QtCore.Qt.AlignCenter)
        self.label_3.setObjectName("label_3")
        self.horizontalLayout_2.addWidget(self.label_3)
        self.maxSpin2 = SpinBox(self.centralwidget)
        self.maxSpin2.setEnabled(False)
        self.maxSpin2.setObjectName("maxSpin2")
        self.horizontalLayout_2.addWidget(self.maxSpin2)
        self.gridLayout_2.addLayout(self.horizontalLayout_2, 5, 2, 1, 1)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.minSpin1 = SpinBox(self.centralwidget)
        self.minSpin1.setObjectName("minSpin1")
        self.horizontalLayout.addWidget(self.minSpin1)
        self.label_2 = QtGui.QLabel(self.centralwidget)
        self.label_2.setAlignment(QtCore.Qt.AlignCenter)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.maxSpin1 = SpinBox(self.centralwidget)
        self.maxSpin1.setObjectName("maxSpin1")
        self.horizontalLayout.addWidget(self.maxSpin1)
        self.gridLayout_2.addLayout(self.horizontalLayout, 4, 2, 1, 1)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.minSpin3 = SpinBox(self.centralwidget)
        self.minSpin3.setEnabled(False)
        self.minSpin3.setObjectName("minSpin3")
        self.horizontalLayout_3.addWidget(self.minSpin3)
        self.label_4 = QtGui.QLabel(self.centralwidget)
        self.label_4.setAlignment(QtCore.Qt.AlignCenter)
        self.label_4.setObjectName("label_4")
        self.horizontalLayout_3.addWidget(self.label_4)
        self.maxSpin3 = SpinBox(self.centralwidget)
        self.maxSpin3.setEnabled(False)
        self.maxSpin3.setObjectName("maxSpin3")
        self.horizontalLayout_3.addWidget(self.maxSpin3)
        self.gridLayout_2.addLayout(self.horizontalLayout_3, 6, 2, 1, 1)
        self.lutCheck = QtGui.QCheckBox(self.centralwidget)
        self.lutCheck.setObjectName("lutCheck")
        self.gridLayout_2.addWidget(self.lutCheck, 7, 0, 1, 1)
        self.alphaCheck = QtGui.QCheckBox(self.centralwidget)
        self.alphaCheck.setObjectName("alphaCheck")
        self.gridLayout_2.addWidget(self.alphaCheck, 7, 1, 1, 1)
        self.gradient = GradientWidget(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.gradient.sizePolicy().hasHeightForWidth())
        self.gradient.setSizePolicy(sizePolicy)
        self.gradient.setObjectName("gradient")
        self.gridLayout_2.addWidget(self.gradient, 7, 2, 1, 2)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem, 3, 3, 1, 1)
        self.fpsLabel = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.fpsLabel.setFont(font)
        self.fpsLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.fpsLabel.setObjectName("fpsLabel")
        self.gridLayout_2.addWidget(self.fpsLabel, 0, 0, 1, 4)
        self.rgbCheck = QtGui.QCheckBox(self.centralwidget)
        self.rgbCheck.setObjectName("rgbCheck")
        self.gridLayout_2.addWidget(self.rgbCheck, 3, 1, 1, 1)
        self.label_5 = QtGui.QLabel(self.centralwidget)
        self.label_5.setObjectName("label_5")
        self.gridLayout_2.addWidget(self.label_5, 2, 0, 1, 1)
        self.horizontalLayout_4 = QtGui.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.framesSpin = QtGui.QSpinBox(self.centralwidget)
        self.framesSpin.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.framesSpin.setProperty("value", 10)
        self.framesSpin.setObjectName("framesSpin")
        self.horizontalLayout_4.addWidget(self.framesSpin)
        self.widthSpin = QtGui.QSpinBox(self.centralwidget)
        self.widthSpin.setButtonSymbols(QtGui.QAbstractSpinBox.PlusMinus)
        self.widthSpin.setMaximum(10000)
        self.widthSpin.setProperty("value", 512)
        self.widthSpin.setObjectName("widthSpin")
        self.horizontalLayout_4.addWidget(self.widthSpin)
        self.heightSpin = QtGui.QSpinBox(self.centralwidget)
        self.heightSpin.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.heightSpin.setMaximum(10000)
        self.heightSpin.setProperty("value", 512)
        self.heightSpin.setObjectName("heightSpin")
        self.horizontalLayout_4.addWidget(self.heightSpin)
        self.gridLayout_2.addLayout(self.horizontalLayout_4, 2, 1, 1, 2)
        self.sizeLabel = QtGui.QLabel(self.centralwidget)
        self.sizeLabel.setText("")
        self.sizeLabel.setObjectName("sizeLabel")
        self.gridLayout_2.addWidget(self.sizeLabel, 2, 3, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        self.stack.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Esempio n. 6
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(695, 798)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.rawRadio = QtGui.QRadioButton(self.centralwidget)
        self.rawRadio.setObjectName("rawRadio")
        self.gridLayout.addWidget(self.rawRadio, 3, 0, 1, 1)
        self.gfxRadio = QtGui.QRadioButton(self.centralwidget)
        self.gfxRadio.setChecked(True)
        self.gfxRadio.setObjectName("gfxRadio")
        self.gridLayout.addWidget(self.gfxRadio, 2, 0, 1, 1)
        self.stack = QtGui.QStackedWidget(self.centralwidget)
        self.stack.setObjectName("stack")
        self.page = QtGui.QWidget()
        self.page.setObjectName("page")
        self.gridLayout_3 = QtGui.QGridLayout(self.page)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.graphicsView = GraphicsView(self.page)
        self.graphicsView.setObjectName("graphicsView")
        self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 1)
        self.stack.addWidget(self.page)
        self.page_2 = QtGui.QWidget()
        self.page_2.setObjectName("page_2")
        self.gridLayout_4 = QtGui.QGridLayout(self.page_2)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.rawImg = RawImageWidget(self.page_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.rawImg.sizePolicy().hasHeightForWidth())
        self.rawImg.setSizePolicy(sizePolicy)
        self.rawImg.setObjectName("rawImg")
        self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1)
        self.stack.addWidget(self.page_2)
        self.page_3 = QtGui.QWidget()
        self.page_3.setObjectName("page_3")
        self.gridLayout_5 = QtGui.QGridLayout(self.page_3)
        self.gridLayout_5.setObjectName("gridLayout_5")
        self.rawGLImg = RawImageGLWidget(self.page_3)
        self.rawGLImg.setObjectName("rawGLImg")
        self.gridLayout_5.addWidget(self.rawGLImg, 0, 0, 1, 1)
        self.stack.addWidget(self.page_3)
        self.gridLayout.addWidget(self.stack, 0, 0, 1, 1)
        self.rawGLRadio = QtGui.QRadioButton(self.centralwidget)
        self.rawGLRadio.setObjectName("rawGLRadio")
        self.gridLayout.addWidget(self.rawGLRadio, 4, 0, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 4)
        self.label = QtGui.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1)
        self.dtypeCombo = QtGui.QComboBox(self.centralwidget)
        self.dtypeCombo.setObjectName("dtypeCombo")
        self.dtypeCombo.addItem("")
        self.dtypeCombo.addItem("")
        self.dtypeCombo.addItem("")
        self.gridLayout_2.addWidget(self.dtypeCombo, 2, 2, 1, 1)
        self.scaleCheck = QtGui.QCheckBox(self.centralwidget)
        self.scaleCheck.setObjectName("scaleCheck")
        self.gridLayout_2.addWidget(self.scaleCheck, 3, 0, 1, 1)
        self.rgbLevelsCheck = QtGui.QCheckBox(self.centralwidget)
        self.rgbLevelsCheck.setObjectName("rgbLevelsCheck")
        self.gridLayout_2.addWidget(self.rgbLevelsCheck, 3, 1, 1, 1)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.minSpin1 = SpinBox(self.centralwidget)
        self.minSpin1.setObjectName("minSpin1")
        self.horizontalLayout.addWidget(self.minSpin1)
        self.label_2 = QtGui.QLabel(self.centralwidget)
        self.label_2.setAlignment(QtCore.Qt.AlignCenter)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.maxSpin1 = SpinBox(self.centralwidget)
        self.maxSpin1.setObjectName("maxSpin1")
        self.horizontalLayout.addWidget(self.maxSpin1)
        self.gridLayout_2.addLayout(self.horizontalLayout, 3, 2, 1, 1)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.minSpin2 = SpinBox(self.centralwidget)
        self.minSpin2.setEnabled(False)
        self.minSpin2.setObjectName("minSpin2")
        self.horizontalLayout_2.addWidget(self.minSpin2)
        self.label_3 = QtGui.QLabel(self.centralwidget)
        self.label_3.setAlignment(QtCore.Qt.AlignCenter)
        self.label_3.setObjectName("label_3")
        self.horizontalLayout_2.addWidget(self.label_3)
        self.maxSpin2 = SpinBox(self.centralwidget)
        self.maxSpin2.setEnabled(False)
        self.maxSpin2.setObjectName("maxSpin2")
        self.horizontalLayout_2.addWidget(self.maxSpin2)
        self.gridLayout_2.addLayout(self.horizontalLayout_2, 4, 2, 1, 1)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.minSpin3 = SpinBox(self.centralwidget)
        self.minSpin3.setEnabled(False)
        self.minSpin3.setObjectName("minSpin3")
        self.horizontalLayout_3.addWidget(self.minSpin3)
        self.label_4 = QtGui.QLabel(self.centralwidget)
        self.label_4.setAlignment(QtCore.Qt.AlignCenter)
        self.label_4.setObjectName("label_4")
        self.horizontalLayout_3.addWidget(self.label_4)
        self.maxSpin3 = SpinBox(self.centralwidget)
        self.maxSpin3.setEnabled(False)
        self.maxSpin3.setObjectName("maxSpin3")
        self.horizontalLayout_3.addWidget(self.maxSpin3)
        self.gridLayout_2.addLayout(self.horizontalLayout_3, 5, 2, 1, 1)
        self.lutCheck = QtGui.QCheckBox(self.centralwidget)
        self.lutCheck.setObjectName("lutCheck")
        self.gridLayout_2.addWidget(self.lutCheck, 6, 0, 1, 1)
        self.alphaCheck = QtGui.QCheckBox(self.centralwidget)
        self.alphaCheck.setObjectName("alphaCheck")
        self.gridLayout_2.addWidget(self.alphaCheck, 6, 1, 1, 1)
        self.gradient = GradientWidget(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.gradient.sizePolicy().hasHeightForWidth())
        self.gradient.setSizePolicy(sizePolicy)
        self.gradient.setObjectName("gradient")
        self.gridLayout_2.addWidget(self.gradient, 6, 2, 1, 2)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem, 2, 3, 1, 1)
        self.fpsLabel = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.fpsLabel.setFont(font)
        self.fpsLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.fpsLabel.setObjectName("fpsLabel")
        self.gridLayout_2.addWidget(self.fpsLabel, 0, 0, 1, 4)
        self.rgbCheck = QtGui.QCheckBox(self.centralwidget)
        self.rgbCheck.setObjectName("rgbCheck")
        self.gridLayout_2.addWidget(self.rgbCheck, 2, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        self.stack.setCurrentIndex(2)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
        self.rawRadio.setText(QtGui.QApplication.translate("MainWindow", "RawImageWidget", None, QtGui.QApplication.UnicodeUTF8))
        self.gfxRadio.setText(QtGui.QApplication.translate("MainWindow", "GraphicsView + ImageItem", None, QtGui.QApplication.UnicodeUTF8))
        self.rawGLRadio.setText(QtGui.QApplication.translate("MainWindow", "RawGLImageWidget", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(QtGui.QApplication.translate("MainWindow", "Data type", None, QtGui.QApplication.UnicodeUTF8))
        self.dtypeCombo.setItemText(0, QtGui.QApplication.translate("MainWindow", "uint8", None, QtGui.QApplication.UnicodeUTF8))
        self.dtypeCombo.setItemText(1, QtGui.QApplication.translate("MainWindow", "uint16", None, QtGui.QApplication.UnicodeUTF8))
        self.dtypeCombo.setItemText(2, QtGui.QApplication.translate("MainWindow", "float", None, QtGui.QApplication.UnicodeUTF8))
        self.scaleCheck.setText(QtGui.QApplication.translate("MainWindow", "Scale Data", None, QtGui.QApplication.UnicodeUTF8))
        self.rgbLevelsCheck.setText(QtGui.QApplication.translate("MainWindow", "RGB", None, QtGui.QApplication.UnicodeUTF8))
        self.label_2.setText(QtGui.QApplication.translate("MainWindow", "<--->", None, QtGui.QApplication.UnicodeUTF8))
        self.label_3.setText(QtGui.QApplication.translate("MainWindow", "<--->", None, QtGui.QApplication.UnicodeUTF8))
        self.label_4.setText(QtGui.QApplication.translate("MainWindow", "<--->", None, QtGui.QApplication.UnicodeUTF8))
        self.lutCheck.setText(QtGui.QApplication.translate("MainWindow", "Use Lookup  Table", None, QtGui.QApplication.UnicodeUTF8))
        self.alphaCheck.setText(QtGui.QApplication.translate("MainWindow", "alpha", None, QtGui.QApplication.UnicodeUTF8))
        self.fpsLabel.setText(QtGui.QApplication.translate("MainWindow", "FPS", None, QtGui.QApplication.UnicodeUTF8))
        self.rgbCheck.setText(QtGui.QApplication.translate("MainWindow", "RGB", None, QtGui.QApplication.UnicodeUTF8))
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(695, 798)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.downsampleCheck = QtWidgets.QCheckBox(self.centralwidget)
        self.downsampleCheck.setObjectName(_fromUtf8("downsampleCheck"))
        self.gridLayout_2.addWidget(self.downsampleCheck, 8, 0, 1, 2)
        self.scaleCheck = QtWidgets.QCheckBox(self.centralwidget)
        self.scaleCheck.setObjectName(_fromUtf8("scaleCheck"))
        self.gridLayout_2.addWidget(self.scaleCheck, 4, 0, 1, 1)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.rawRadio = QtWidgets.QRadioButton(self.centralwidget)
        self.rawRadio.setObjectName(_fromUtf8("rawRadio"))
        self.gridLayout.addWidget(self.rawRadio, 3, 0, 1, 1)
        self.gfxRadio = QtWidgets.QRadioButton(self.centralwidget)
        self.gfxRadio.setChecked(True)
        self.gfxRadio.setObjectName(_fromUtf8("gfxRadio"))
        self.gridLayout.addWidget(self.gfxRadio, 2, 0, 1, 1)
        self.stack = QtWidgets.QStackedWidget(self.centralwidget)
        self.stack.setObjectName(_fromUtf8("stack"))
        self.page = QtWidgets.QWidget()
        self.page.setObjectName(_fromUtf8("page"))
        self.gridLayout_3 = QtWidgets.QGridLayout(self.page)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.graphicsView = GraphicsView(self.page)
        self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
        self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 1)
        self.stack.addWidget(self.page)
        self.page_2 = QtWidgets.QWidget()
        self.page_2.setObjectName(_fromUtf8("page_2"))
        self.gridLayout_4 = QtWidgets.QGridLayout(self.page_2)
        self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
        self.rawImg = RawImageWidget(self.page_2)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.rawImg.sizePolicy().hasHeightForWidth())
        self.rawImg.setSizePolicy(sizePolicy)
        self.rawImg.setObjectName(_fromUtf8("rawImg"))
        self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1)
        self.stack.addWidget(self.page_2)
        self.page_3 = QtWidgets.QWidget()
        self.page_3.setObjectName(_fromUtf8("page_3"))
        self.gridLayout_5 = QtWidgets.QGridLayout(self.page_3)
        self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
        self.rawGLImg = RawImageGLWidget(self.page_3)
        self.rawGLImg.setObjectName(_fromUtf8("rawGLImg"))
        self.gridLayout_5.addWidget(self.rawGLImg, 0, 0, 1, 1)
        self.stack.addWidget(self.page_3)
        self.gridLayout.addWidget(self.stack, 0, 0, 1, 1)
        self.rawGLRadio = QtWidgets.QRadioButton(self.centralwidget)
        self.rawGLRadio.setObjectName(_fromUtf8("rawGLRadio"))
        self.gridLayout.addWidget(self.rawGLRadio, 4, 0, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 4)
        self.dtypeCombo = QtWidgets.QComboBox(self.centralwidget)
        self.dtypeCombo.setObjectName(_fromUtf8("dtypeCombo"))
        self.dtypeCombo.addItem(_fromUtf8(""))
        self.dtypeCombo.addItem(_fromUtf8(""))
        self.dtypeCombo.addItem(_fromUtf8(""))
        self.gridLayout_2.addWidget(self.dtypeCombo, 3, 2, 1, 1)
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout_2.addWidget(self.label, 3, 0, 1, 1)
        self.rgbLevelsCheck = QtWidgets.QCheckBox(self.centralwidget)
        self.rgbLevelsCheck.setObjectName(_fromUtf8("rgbLevelsCheck"))
        self.gridLayout_2.addWidget(self.rgbLevelsCheck, 4, 1, 1, 1)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.minSpin2 = SpinBox(self.centralwidget)
        self.minSpin2.setEnabled(False)
        self.minSpin2.setObjectName(_fromUtf8("minSpin2"))
        self.horizontalLayout_2.addWidget(self.minSpin2)
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setAlignment(QtCore.Qt.AlignCenter)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.horizontalLayout_2.addWidget(self.label_3)
        self.maxSpin2 = SpinBox(self.centralwidget)
        self.maxSpin2.setEnabled(False)
        self.maxSpin2.setObjectName(_fromUtf8("maxSpin2"))
        self.horizontalLayout_2.addWidget(self.maxSpin2)
        self.gridLayout_2.addLayout(self.horizontalLayout_2, 5, 2, 1, 1)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.minSpin1 = SpinBox(self.centralwidget)
        self.minSpin1.setObjectName(_fromUtf8("minSpin1"))
        self.horizontalLayout.addWidget(self.minSpin1)
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setAlignment(QtCore.Qt.AlignCenter)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.horizontalLayout.addWidget(self.label_2)
        self.maxSpin1 = SpinBox(self.centralwidget)
        self.maxSpin1.setObjectName(_fromUtf8("maxSpin1"))
        self.horizontalLayout.addWidget(self.maxSpin1)
        self.gridLayout_2.addLayout(self.horizontalLayout, 4, 2, 1, 1)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.minSpin3 = SpinBox(self.centralwidget)
        self.minSpin3.setEnabled(False)
        self.minSpin3.setObjectName(_fromUtf8("minSpin3"))
        self.horizontalLayout_3.addWidget(self.minSpin3)
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setAlignment(QtCore.Qt.AlignCenter)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.horizontalLayout_3.addWidget(self.label_4)
        self.maxSpin3 = SpinBox(self.centralwidget)
        self.maxSpin3.setEnabled(False)
        self.maxSpin3.setObjectName(_fromUtf8("maxSpin3"))
        self.horizontalLayout_3.addWidget(self.maxSpin3)
        self.gridLayout_2.addLayout(self.horizontalLayout_3, 6, 2, 1, 1)
        self.lutCheck = QtWidgets.QCheckBox(self.centralwidget)
        self.lutCheck.setObjectName(_fromUtf8("lutCheck"))
        self.gridLayout_2.addWidget(self.lutCheck, 7, 0, 1, 1)
        self.alphaCheck = QtWidgets.QCheckBox(self.centralwidget)
        self.alphaCheck.setObjectName(_fromUtf8("alphaCheck"))
        self.gridLayout_2.addWidget(self.alphaCheck, 7, 1, 1, 1)
        self.gradient = GradientWidget(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.gradient.sizePolicy().hasHeightForWidth())
        self.gradient.setSizePolicy(sizePolicy)
        self.gradient.setObjectName(_fromUtf8("gradient"))
        self.gridLayout_2.addWidget(self.gradient, 7, 2, 1, 2)
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem, 3, 3, 1, 1)
        self.fpsLabel = QtWidgets.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.fpsLabel.setFont(font)
        self.fpsLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.fpsLabel.setObjectName(_fromUtf8("fpsLabel"))
        self.gridLayout_2.addWidget(self.fpsLabel, 0, 0, 1, 4)
        self.rgbCheck = QtWidgets.QCheckBox(self.centralwidget)
        self.rgbCheck.setObjectName(_fromUtf8("rgbCheck"))
        self.gridLayout_2.addWidget(self.rgbCheck, 3, 1, 1, 1)
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.gridLayout_2.addWidget(self.label_5, 2, 0, 1, 1)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
        self.framesSpin = QtWidgets.QSpinBox(self.centralwidget)
        self.framesSpin.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.framesSpin.setProperty("value", 10)
        self.framesSpin.setObjectName(_fromUtf8("framesSpin"))
        self.horizontalLayout_4.addWidget(self.framesSpin)
        self.widthSpin = QtWidgets.QSpinBox(self.centralwidget)
        self.widthSpin.setButtonSymbols(QtWidgets.QAbstractSpinBox.PlusMinus)
        self.widthSpin.setMaximum(10000)
        self.widthSpin.setProperty("value", 512)
        self.widthSpin.setObjectName(_fromUtf8("widthSpin"))
        self.horizontalLayout_4.addWidget(self.widthSpin)
        self.heightSpin = QtWidgets.QSpinBox(self.centralwidget)
        self.heightSpin.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.heightSpin.setMaximum(10000)
        self.heightSpin.setProperty("value", 512)
        self.heightSpin.setObjectName(_fromUtf8("heightSpin"))
        self.horizontalLayout_4.addWidget(self.heightSpin)
        self.gridLayout_2.addLayout(self.horizontalLayout_4, 2, 1, 1, 2)
        self.sizeLabel = QtWidgets.QLabel(self.centralwidget)
        self.sizeLabel.setText(_fromUtf8(""))
        self.sizeLabel.setObjectName(_fromUtf8("sizeLabel"))
        self.gridLayout_2.addWidget(self.sizeLabel, 2, 3, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        self.stack.setCurrentIndex(2)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Esempio n. 8
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(695, 798)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.gridLayout_2 = QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName(u"gridLayout_2")
        self.cudaCheck = QCheckBox(self.centralwidget)
        self.cudaCheck.setObjectName(u"cudaCheck")

        self.gridLayout_2.addWidget(self.cudaCheck, 9, 0, 1, 2)

        self.downsampleCheck = QCheckBox(self.centralwidget)
        self.downsampleCheck.setObjectName(u"downsampleCheck")

        self.gridLayout_2.addWidget(self.downsampleCheck, 8, 0, 1, 2)

        self.scaleCheck = QCheckBox(self.centralwidget)
        self.scaleCheck.setObjectName(u"scaleCheck")

        self.gridLayout_2.addWidget(self.scaleCheck, 4, 0, 1, 1)

        self.gridLayout = QGridLayout()
        self.gridLayout.setObjectName(u"gridLayout")
        self.rawRadio = QRadioButton(self.centralwidget)
        self.rawRadio.setObjectName(u"rawRadio")

        self.gridLayout.addWidget(self.rawRadio, 3, 0, 1, 1)

        self.gfxRadio = QRadioButton(self.centralwidget)
        self.gfxRadio.setObjectName(u"gfxRadio")
        self.gfxRadio.setChecked(True)

        self.gridLayout.addWidget(self.gfxRadio, 2, 0, 1, 1)

        self.stack = QStackedWidget(self.centralwidget)
        self.stack.setObjectName(u"stack")
        self.page = QWidget()
        self.page.setObjectName(u"page")
        self.gridLayout_3 = QGridLayout(self.page)
        self.gridLayout_3.setObjectName(u"gridLayout_3")
        self.graphicsView = GraphicsView(self.page)
        self.graphicsView.setObjectName(u"graphicsView")

        self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 1)

        self.stack.addWidget(self.page)
        self.page_2 = QWidget()
        self.page_2.setObjectName(u"page_2")
        self.gridLayout_4 = QGridLayout(self.page_2)
        self.gridLayout_4.setObjectName(u"gridLayout_4")
        self.rawImg = RawImageWidget(self.page_2)
        self.rawImg.setObjectName(u"rawImg")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.rawImg.sizePolicy().hasHeightForWidth())
        self.rawImg.setSizePolicy(sizePolicy)

        self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1)

        self.stack.addWidget(self.page_2)

        self.gridLayout.addWidget(self.stack, 0, 0, 1, 1)

        self.rawGLRadio = QRadioButton(self.centralwidget)
        self.rawGLRadio.setObjectName(u"rawGLRadio")

        self.gridLayout.addWidget(self.rawGLRadio, 4, 0, 1, 1)

        self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 4)

        self.dtypeCombo = QComboBox(self.centralwidget)
        self.dtypeCombo.addItem("")
        self.dtypeCombo.addItem("")
        self.dtypeCombo.addItem("")
        self.dtypeCombo.setObjectName(u"dtypeCombo")

        self.gridLayout_2.addWidget(self.dtypeCombo, 3, 2, 1, 1)

        self.label = QLabel(self.centralwidget)
        self.label.setObjectName(u"label")

        self.gridLayout_2.addWidget(self.label, 3, 0, 1, 1)

        self.rgbLevelsCheck = QCheckBox(self.centralwidget)
        self.rgbLevelsCheck.setObjectName(u"rgbLevelsCheck")

        self.gridLayout_2.addWidget(self.rgbLevelsCheck, 4, 1, 1, 1)

        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
        self.minSpin2 = SpinBox(self.centralwidget)
        self.minSpin2.setObjectName(u"minSpin2")
        self.minSpin2.setEnabled(False)

        self.horizontalLayout_2.addWidget(self.minSpin2)

        self.label_3 = QLabel(self.centralwidget)
        self.label_3.setObjectName(u"label_3")
        self.label_3.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_2.addWidget(self.label_3)

        self.maxSpin2 = SpinBox(self.centralwidget)
        self.maxSpin2.setObjectName(u"maxSpin2")
        self.maxSpin2.setEnabled(False)

        self.horizontalLayout_2.addWidget(self.maxSpin2)

        self.gridLayout_2.addLayout(self.horizontalLayout_2, 5, 2, 1, 1)

        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.minSpin1 = SpinBox(self.centralwidget)
        self.minSpin1.setObjectName(u"minSpin1")

        self.horizontalLayout.addWidget(self.minSpin1)

        self.label_2 = QLabel(self.centralwidget)
        self.label_2.setObjectName(u"label_2")
        self.label_2.setAlignment(Qt.AlignCenter)

        self.horizontalLayout.addWidget(self.label_2)

        self.maxSpin1 = SpinBox(self.centralwidget)
        self.maxSpin1.setObjectName(u"maxSpin1")

        self.horizontalLayout.addWidget(self.maxSpin1)

        self.gridLayout_2.addLayout(self.horizontalLayout, 4, 2, 1, 1)

        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
        self.minSpin3 = SpinBox(self.centralwidget)
        self.minSpin3.setObjectName(u"minSpin3")
        self.minSpin3.setEnabled(False)

        self.horizontalLayout_3.addWidget(self.minSpin3)

        self.label_4 = QLabel(self.centralwidget)
        self.label_4.setObjectName(u"label_4")
        self.label_4.setAlignment(Qt.AlignCenter)

        self.horizontalLayout_3.addWidget(self.label_4)

        self.maxSpin3 = SpinBox(self.centralwidget)
        self.maxSpin3.setObjectName(u"maxSpin3")
        self.maxSpin3.setEnabled(False)

        self.horizontalLayout_3.addWidget(self.maxSpin3)

        self.gridLayout_2.addLayout(self.horizontalLayout_3, 6, 2, 1, 1)

        self.lutCheck = QCheckBox(self.centralwidget)
        self.lutCheck.setObjectName(u"lutCheck")

        self.gridLayout_2.addWidget(self.lutCheck, 7, 0, 1, 1)

        self.alphaCheck = QCheckBox(self.centralwidget)
        self.alphaCheck.setObjectName(u"alphaCheck")

        self.gridLayout_2.addWidget(self.alphaCheck, 7, 1, 1, 1)

        self.gradient = GradientWidget(self.centralwidget)
        self.gradient.setObjectName(u"gradient")
        sizePolicy.setHeightForWidth(
            self.gradient.sizePolicy().hasHeightForWidth())
        self.gradient.setSizePolicy(sizePolicy)

        self.gridLayout_2.addWidget(self.gradient, 7, 2, 1, 2)

        self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                            QSizePolicy.Minimum)

        self.gridLayout_2.addItem(self.horizontalSpacer, 3, 3, 1, 1)

        self.fpsLabel = QLabel(self.centralwidget)
        self.fpsLabel.setObjectName(u"fpsLabel")
        font = QFont()
        font.setPointSize(12)
        self.fpsLabel.setFont(font)
        self.fpsLabel.setAlignment(Qt.AlignCenter)

        self.gridLayout_2.addWidget(self.fpsLabel, 0, 0, 1, 4)

        self.rgbCheck = QCheckBox(self.centralwidget)
        self.rgbCheck.setObjectName(u"rgbCheck")

        self.gridLayout_2.addWidget(self.rgbCheck, 3, 1, 1, 1)

        self.label_5 = QLabel(self.centralwidget)
        self.label_5.setObjectName(u"label_5")

        self.gridLayout_2.addWidget(self.label_5, 2, 0, 1, 1)

        self.horizontalLayout_4 = QHBoxLayout()
        self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
        self.framesSpin = QSpinBox(self.centralwidget)
        self.framesSpin.setObjectName(u"framesSpin")
        self.framesSpin.setButtonSymbols(QAbstractSpinBox.NoButtons)
        self.framesSpin.setValue(10)

        self.horizontalLayout_4.addWidget(self.framesSpin)

        self.widthSpin = QSpinBox(self.centralwidget)
        self.widthSpin.setObjectName(u"widthSpin")
        self.widthSpin.setButtonSymbols(QAbstractSpinBox.PlusMinus)
        self.widthSpin.setMaximum(10000)
        self.widthSpin.setValue(512)

        self.horizontalLayout_4.addWidget(self.widthSpin)

        self.heightSpin = QSpinBox(self.centralwidget)
        self.heightSpin.setObjectName(u"heightSpin")
        self.heightSpin.setButtonSymbols(QAbstractSpinBox.NoButtons)
        self.heightSpin.setMaximum(10000)
        self.heightSpin.setValue(512)

        self.horizontalLayout_4.addWidget(self.heightSpin)

        self.gridLayout_2.addLayout(self.horizontalLayout_4, 2, 1, 1, 2)

        self.sizeLabel = QLabel(self.centralwidget)
        self.sizeLabel.setObjectName(u"sizeLabel")

        self.gridLayout_2.addWidget(self.sizeLabel, 2, 3, 1, 1)

        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)

        self.stack.setCurrentIndex(1)

        QMetaObject.connectSlotsByName(MainWindow)

    # setupUi

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(
            QCoreApplication.translate("MainWindow", u"MainWindow", None))
        self.cudaCheck.setText(
            QCoreApplication.translate("MainWindow",
                                       u"Use CUDA (GPU) if available", None))
        self.downsampleCheck.setText(
            QCoreApplication.translate("MainWindow", u"Auto downsample", None))
        self.scaleCheck.setText(
            QCoreApplication.translate("MainWindow", u"Scale Data", None))
        self.rawRadio.setText(
            QCoreApplication.translate("MainWindow", u"RawImageWidget", None))
        self.gfxRadio.setText(
            QCoreApplication.translate("MainWindow",
                                       u"GraphicsView + ImageItem", None))
        self.rawGLRadio.setText(
            QCoreApplication.translate("MainWindow", u"RawGLImageWidget",
                                       None))
        self.dtypeCombo.setItemText(
            0, QCoreApplication.translate("MainWindow", u"uint8", None))
        self.dtypeCombo.setItemText(
            1, QCoreApplication.translate("MainWindow", u"uint16", None))
        self.dtypeCombo.setItemText(
            2, QCoreApplication.translate("MainWindow", u"float", None))

        self.label.setText(
            QCoreApplication.translate("MainWindow", u"Data type", None))
        self.rgbLevelsCheck.setText(
            QCoreApplication.translate("MainWindow", u"RGB", None))
        self.label_3.setText(
            QCoreApplication.translate("MainWindow", u"<--->", None))
        self.label_2.setText(
            QCoreApplication.translate("MainWindow", u"<--->", None))
        self.label_4.setText(
            QCoreApplication.translate("MainWindow", u"<--->", None))
        self.lutCheck.setText(
            QCoreApplication.translate("MainWindow", u"Use Lookup  Table",
                                       None))
        self.alphaCheck.setText(
            QCoreApplication.translate("MainWindow", u"alpha", None))
        self.fpsLabel.setText(
            QCoreApplication.translate("MainWindow", u"FPS", None))
        self.rgbCheck.setText(
            QCoreApplication.translate("MainWindow", u"RGB", None))
        self.label_5.setText(
            QCoreApplication.translate("MainWindow", u"Image size", None))
        self.sizeLabel.setText("")
# init viewer application
viewer_app = QtGui.QApplication([])

# define window and set layout
viewer_window = QtGui.QWidget()
viewer_window.setWindowTitle("Retina Simulation")
viewer_window.setFixedSize(win_width, win_height)
viewer_layout = QtGui.QGridLayout()
viewer_window.setLayout(viewer_layout)

# Frame widgets
frame_wg = QtGui.QWidget()
frame_layout = QtGui.QHBoxLayout()
frame_wg.setLayout(frame_layout)
draw_frame = RawImageWidget()
draw_frame.setImage(bg_frame)
draw_parvo = RawImageWidget()
draw_parvo.setImage(bg_frame)
draw_magno = RawImageWidget()
draw_magno.setImage(bg_frame)

frame_layout.addWidget(draw_frame)
frame_layout.addWidget(draw_parvo)
frame_layout.addWidget(draw_magno)

# IPL and OPL Parvo Parameters Widget
PARVO_wg = QtGui.QWidget()
PARVO_layout = QtGui.QFormLayout()
PARVO_layout.setRowWrapPolicy(QtGui.QFormLayout.DontWrapRows)
PARVO_layout.setFieldGrowthPolicy(QtGui.QFormLayout.FieldsStayAtSizeHint)
Esempio n. 10
0
def main():
    global app, img, x, y, MAX_FRAMES
    global args

    parser = argparse.ArgumentParser(description='AreaDetector video example')

    parser.add_argument(
        "ImagePV", help="EPICS PVA image PV name, such as 13PG2:Pva1:Image")
    parser.add_argument('--benchmark',
                        action='store_true',
                        help='measure framerate')
    parser.add_argument('--noAGC',
                        action='store_true',
                        help='disable auto gain')
    parser.add_argument('--frames',
                        help='maximum number of frames (-1: unlimited)')

    parser.add_argument('--bindip',
                        default=None,
                        help='ip address to bind tmq)')
    parser.add_argument('--port',
                        type=int,
                        default=5560,
                        help='Port address to bind tmq')
    parser.add_argument('--beg_sinogram',
                        type=int,
                        help='Starting sinogram for reconstruction')
    parser.add_argument('--num_sinograms',
                        type=int,
                        help='Number of sinograms to reconstruct')
    parser.add_argument('--mock_data',
                        action='store_true',
                        default=False,
                        help='Mock data acquisition from file')
    parser.add_argument('--mock_file',
                        help='File name for mock data acquisition')

    args = parser.parse_args()

    global start_sino, num_sinos, mock_data
    start_sino = args.beg_sinogram
    num_sinos = args.num_sinograms
    mock_data = args.mock_data

    if mock_data:
        print("Mock data is set")
        setup_mock_data(args.mock_file)

    app = QtGui.QApplication([])
    win = QtWidgets.QWidget()
    win.setWindowTitle('daqScope')
    layout = QtGui.QGridLayout()
    layout.setMargin(0)
    win.setLayout(layout)
    img = RawImageWidget(win)
    layout.addWidget(img, 0, 0, 0, 0)
    win.show()
    chan = pvaccess.Channel(args.ImagePV)

    global x, y
    x, y = chan.get('field()')['dimension']
    x = x['size']
    y = y['size']
    win.resize(x, y)

    #### Setup TMQ #####
    tmq.init_tmq()
    # Handshake w. remote processes
    # For set TMQ for 2 sinograms
    print(type(x))
    print(type(num_sinos))
    if mock_data:
        print("Mock data handshake: input data shape={}".format(idata.shape))
        tmq.handshake(args.bindip, args.port, int(num_sinos), idata.shape[2])
    else:
        print("Streaming data handshake: input data shape={},{}".format(
            int(num_sinos), int(x)))
        tmq.handshake(args.bindip, args.port, int(num_sinos), int(x))
    ####################

    chan.subscribe('update', update)
    chan.startMonitor()

    if args.benchmark:
        start = time.time()

    # Finalize streaming ?
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
        chan.stopMonitor()
        chan.unsubscribe('update')
        print("Remove")
        # Finalize TMQ
        tmq.done_image()
        tmq.finalize_tmq()

    if args.benchmark:
        stop = time.time()
        print('Frames displayed: %d' % framesDisplayed)
        print('Elapsed time:     %.3f sec' % (stop - start))
        print('Frames per second: %.3f FPS' % (framesDisplayed /
                                               (stop - start)))
Esempio n. 11
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(695, 798)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.rawRadio = QtGui.QRadioButton(self.centralwidget)
        self.rawRadio.setObjectName(_fromUtf8("rawRadio"))
        self.gridLayout.addWidget(self.rawRadio, 3, 0, 1, 1)
        self.gfxRadio = QtGui.QRadioButton(self.centralwidget)
        self.gfxRadio.setChecked(True)
        self.gfxRadio.setObjectName(_fromUtf8("gfxRadio"))
        self.gridLayout.addWidget(self.gfxRadio, 2, 0, 1, 1)
        self.stack = QtGui.QStackedWidget(self.centralwidget)
        self.stack.setObjectName(_fromUtf8("stack"))
        self.page = QtGui.QWidget()
        self.page.setObjectName(_fromUtf8("page"))
        self.gridLayout_3 = QtGui.QGridLayout(self.page)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.graphicsView = GraphicsView(self.page)
        self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
        self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 1)
        self.stack.addWidget(self.page)
        self.page_2 = QtGui.QWidget()
        self.page_2.setObjectName(_fromUtf8("page_2"))
        self.gridLayout_4 = QtGui.QGridLayout(self.page_2)
        self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
        self.rawImg = RawImageWidget(self.page_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.rawImg.sizePolicy().hasHeightForWidth())
        self.rawImg.setSizePolicy(sizePolicy)
        self.rawImg.setObjectName(_fromUtf8("rawImg"))
        self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1)
        self.stack.addWidget(self.page_2)
        self.page_3 = QtGui.QWidget()
        self.page_3.setObjectName(_fromUtf8("page_3"))
        self.gridLayout_5 = QtGui.QGridLayout(self.page_3)
        self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
        self.rawGLImg = RawImageGLWidget(self.page_3)
        self.rawGLImg.setObjectName(_fromUtf8("rawGLImg"))
        self.gridLayout_5.addWidget(self.rawGLImg, 0, 0, 1, 1)
        self.stack.addWidget(self.page_3)
        self.gridLayout.addWidget(self.stack, 0, 0, 1, 1)
        self.rawGLRadio = QtGui.QRadioButton(self.centralwidget)
        self.rawGLRadio.setObjectName(_fromUtf8("rawGLRadio"))
        self.gridLayout.addWidget(self.rawGLRadio, 4, 0, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 4)
        self.label = QtGui.QLabel(self.centralwidget)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1)
        self.dtypeCombo = QtGui.QComboBox(self.centralwidget)
        self.dtypeCombo.setObjectName(_fromUtf8("dtypeCombo"))
        self.dtypeCombo.addItem(_fromUtf8(""))
        self.dtypeCombo.addItem(_fromUtf8(""))
        self.dtypeCombo.addItem(_fromUtf8(""))
        self.gridLayout_2.addWidget(self.dtypeCombo, 2, 2, 1, 1)
        self.scaleCheck = QtGui.QCheckBox(self.centralwidget)
        self.scaleCheck.setObjectName(_fromUtf8("scaleCheck"))
        self.gridLayout_2.addWidget(self.scaleCheck, 3, 0, 1, 1)
        self.rgbLevelsCheck = QtGui.QCheckBox(self.centralwidget)
        self.rgbLevelsCheck.setObjectName(_fromUtf8("rgbLevelsCheck"))
        self.gridLayout_2.addWidget(self.rgbLevelsCheck, 3, 1, 1, 1)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.minSpin1 = SpinBox(self.centralwidget)
        self.minSpin1.setObjectName(_fromUtf8("minSpin1"))
        self.horizontalLayout.addWidget(self.minSpin1)
        self.label_2 = QtGui.QLabel(self.centralwidget)
        self.label_2.setAlignment(QtCore.Qt.AlignCenter)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.horizontalLayout.addWidget(self.label_2)
        self.maxSpin1 = SpinBox(self.centralwidget)
        self.maxSpin1.setObjectName(_fromUtf8("maxSpin1"))
        self.horizontalLayout.addWidget(self.maxSpin1)
        self.gridLayout_2.addLayout(self.horizontalLayout, 3, 2, 1, 1)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.minSpin2 = SpinBox(self.centralwidget)
        self.minSpin2.setEnabled(False)
        self.minSpin2.setObjectName(_fromUtf8("minSpin2"))
        self.horizontalLayout_2.addWidget(self.minSpin2)
        self.label_3 = QtGui.QLabel(self.centralwidget)
        self.label_3.setAlignment(QtCore.Qt.AlignCenter)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.horizontalLayout_2.addWidget(self.label_3)
        self.maxSpin2 = SpinBox(self.centralwidget)
        self.maxSpin2.setEnabled(False)
        self.maxSpin2.setObjectName(_fromUtf8("maxSpin2"))
        self.horizontalLayout_2.addWidget(self.maxSpin2)
        self.gridLayout_2.addLayout(self.horizontalLayout_2, 4, 2, 1, 1)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.minSpin3 = SpinBox(self.centralwidget)
        self.minSpin3.setEnabled(False)
        self.minSpin3.setObjectName(_fromUtf8("minSpin3"))
        self.horizontalLayout_3.addWidget(self.minSpin3)
        self.label_4 = QtGui.QLabel(self.centralwidget)
        self.label_4.setAlignment(QtCore.Qt.AlignCenter)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.horizontalLayout_3.addWidget(self.label_4)
        self.maxSpin3 = SpinBox(self.centralwidget)
        self.maxSpin3.setEnabled(False)
        self.maxSpin3.setObjectName(_fromUtf8("maxSpin3"))
        self.horizontalLayout_3.addWidget(self.maxSpin3)
        self.gridLayout_2.addLayout(self.horizontalLayout_3, 5, 2, 1, 1)
        self.lutCheck = QtGui.QCheckBox(self.centralwidget)
        self.lutCheck.setObjectName(_fromUtf8("lutCheck"))
        self.gridLayout_2.addWidget(self.lutCheck, 6, 0, 1, 1)
        self.alphaCheck = QtGui.QCheckBox(self.centralwidget)
        self.alphaCheck.setObjectName(_fromUtf8("alphaCheck"))
        self.gridLayout_2.addWidget(self.alphaCheck, 6, 1, 1, 1)
        self.gradient = GradientWidget(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.gradient.sizePolicy().hasHeightForWidth())
        self.gradient.setSizePolicy(sizePolicy)
        self.gradient.setObjectName(_fromUtf8("gradient"))
        self.gridLayout_2.addWidget(self.gradient, 6, 2, 1, 2)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem, 2, 3, 1, 1)
        self.fpsLabel = QtGui.QLabel(self.centralwidget)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.fpsLabel.setFont(font)
        self.fpsLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.fpsLabel.setObjectName(_fromUtf8("fpsLabel"))
        self.gridLayout_2.addWidget(self.fpsLabel, 0, 0, 1, 4)
        self.rgbCheck = QtGui.QCheckBox(self.centralwidget)
        self.rgbCheck.setObjectName(_fromUtf8("rgbCheck"))
        self.gridLayout_2.addWidget(self.rgbCheck, 2, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        self.stack.setCurrentIndex(2)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
        self.rawRadio.setText(_translate("MainWindow", "RawImageWidget", None))
        self.gfxRadio.setText(_translate("MainWindow", "GraphicsView + ImageItem", None))
        self.rawGLRadio.setText(_translate("MainWindow", "RawGLImageWidget", None))
        self.label.setText(_translate("MainWindow", "Data type", None))
        self.dtypeCombo.setItemText(0, _translate("MainWindow", "uint8", None))
        self.dtypeCombo.setItemText(1, _translate("MainWindow", "uint16", None))
        self.dtypeCombo.setItemText(2, _translate("MainWindow", "float", None))
        self.scaleCheck.setText(_translate("MainWindow", "Scale Data", None))
        self.rgbLevelsCheck.setText(_translate("MainWindow", "RGB", None))
        self.label_2.setText(_translate("MainWindow", "<--->", None))
        self.label_3.setText(_translate("MainWindow", "<--->", None))
        self.label_4.setText(_translate("MainWindow", "<--->", None))
        self.lutCheck.setText(_translate("MainWindow", "Use Lookup  Table", None))
        self.alphaCheck.setText(_translate("MainWindow", "alpha", None))
        self.fpsLabel.setText(_translate("MainWindow", "FPS", None))
        self.rgbCheck.setText(_translate("MainWindow", "RGB", None))
Esempio n. 12
0
class QtPlotter(object):
    def __init__(self, app):
        super(QtPlotter, self).__init__()
        self.app = app
        self.create_QtPlotter()
        self.data = None

    def create_QtPlotter(self):
        self.RAW = 1
        if self.RAW:
            self.win = QtGui.QMainWindow()
            self.win.resize(400, 400)
            self.rawImg = RawImageWidget(self.win, scaled=True)
            self.win.setCentralWidget(self.rawImg)
            self.win.show()
        else:
            self.win = pg.GraphicsLayoutWidget()
            self.win.show()
            self.win.setWindowTitle("TART2 - Live View")
            view = self.win.addViewBox()
            view.setAspectLocked(True)
            self.img = pg.ImageItem(border="w")
            view.addItem(self.img)
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.update)
        self.timer.start(0)
        self.q = Queue()

    def getPort(self):
        return self.q

    def update(self):
        # qsize = self.q.qsize()
        # print 'PlotQ size',qsize
        # if qsize > 2:
        # [self.q.get() for _ in range(qsize-1)]
        # print '!!!!!!!!!!!!!!!!!!!!!! dropping frames when displaying  !!!!!!!!!!!!!!!!!!!!!!!!!!!!'
        a = time.time()
        if not self.q.empty():
            # while not self.q.empty():
            # print self.q.qsize()
            # if self.data is None:
            self.data = self.q.get()
            # else:
            # self.data[:] = self.q.get()
            # print 'drop drop drop.'
            # print data[0]
            b = time.time()
            print(b - a, "getting data off queue")
            if self.RAW:
                d_max = self.data.max()
                self.data /= d_max
                self.data *= 255
                self.rawImg.setImage(self.data)
            else:
                self.data -= self.data.min()
                self.data /= self.data.max()
                self.data *= 255
                # self.img.setImage(data,autoRange=True,autoLevels=True)
                self.img.setImage(self.data)
            self.app.processEvents()
            c = time.time()
            print(c - b, "update done.")
# init viewer application
viewer_app = QtGui.QApplication([])

# define window and set layout
viewer_window = QtGui.QWidget()
viewer_window.setWindowTitle("Retina Simulation")
viewer_window.setFixedSize(win_width, win_height)
viewer_layout = QtGui.QGridLayout()
viewer_window.setLayout(viewer_layout)

# Frame widgets
frame_wg = QtGui.QWidget()
frame_layout = QtGui.QHBoxLayout()
frame_wg.setLayout(frame_layout)
draw_frame = RawImageWidget()
draw_frame.setImage(bg_frame)
draw_parvo = RawImageWidget()
draw_parvo.setImage(bg_frame)
draw_magno = RawImageWidget()
draw_magno.setImage(bg_frame)

frame_layout.addWidget(draw_frame)
frame_layout.addWidget(draw_parvo)
frame_layout.addWidget(draw_magno)

# IPL and OPL Parvo Parameters Widget
PARVO_wg = QtGui.QWidget()
PARVO_layout = QtGui.QFormLayout()
PARVO_layout.setRowWrapPolicy(QtGui.QFormLayout.DontWrapRows)
PARVO_layout.setFieldGrowthPolicy(QtGui.QFormLayout.FieldsStayAtSizeHint)