def update():
    global ui, ptr, lastTime, fps, LUT, img
    if ui.lutCheck.isChecked():
        useLut = LUT
    else:
        useLut = None
    downsample = ui.downsampleCheck.isChecked()
    if ui.scaleCheck.isChecked():
        if ui.rgbLevelsCheck.isChecked():
            useScale = [[ui.minSpin1.value(), ui.maxSpin1.value()], [ui.minSpin2.value(), ui.maxSpin2.value()], [ui.minSpin3.value(), ui.maxSpin3.value()]]
        else:
            useScale = [ui.minSpin1.value(), ui.maxSpin1.value()]
    else:
        useScale = None
    if ui.rawRadio.isChecked():
        ui.rawImg.setImage(data[(ptr % data.shape[0])], lut=useLut, levels=useScale)
        ui.stack.setCurrentIndex(1)
    elif ui.rawGLRadio.isChecked():
        ui.rawGLImg.setImage(data[(ptr % data.shape[0])], lut=useLut, levels=useScale)
        ui.stack.setCurrentIndex(2)
    else:
        img.setImage(data[(ptr % data.shape[0])], autoLevels=False, levels=useScale, lut=useLut, autoDownsample=downsample)
        ui.stack.setCurrentIndex(0)
    ptr += 1
    now = ptime.time()
    dt = (now - lastTime)
    lastTime = now
    if (fps is None):
        fps = (1.0 / dt)
    else:
        s = np.clip((dt * 3.0), 0, 1)
        fps = ((fps * (1 - s)) + ((1.0 / dt) * s))
    ui.fpsLabel.setText(('%0.2f fps' % fps))
    app.processEvents()
def update():
    global ui, ptr, lastTime, fps, LUT, img
    if ui.lutCheck.isChecked():
        useLut = LUT
    else:
        useLut = None
    downsample = ui.downsampleCheck.isChecked()
    if ui.scaleCheck.isChecked():
        if ui.rgbLevelsCheck.isChecked():
            useScale = [[ui.minSpin1.value(), ui.maxSpin1.value()], [ui.minSpin2.value(), ui.maxSpin2.value()], [ui.minSpin3.value(), ui.maxSpin3.value()]]
        else:
            useScale = [ui.minSpin1.value(), ui.maxSpin1.value()]
    else:
        useScale = None
    if ui.rawRadio.isChecked():
        ui.rawImg.setImage(data[(ptr % data.shape[0])], lut=useLut, levels=useScale)
        ui.stack.setCurrentIndex(1)
    elif ui.rawGLRadio.isChecked():
        ui.rawGLImg.setImage(data[(ptr % data.shape[0])], lut=useLut, levels=useScale)
        ui.stack.setCurrentIndex(2)
    else:
        img.setImage(data[(ptr % data.shape[0])], autoLevels=False, levels=useScale, lut=useLut, autoDownsample=downsample)
        ui.stack.setCurrentIndex(0)
    ptr += 1
    now = ptime.time()
    dt = (now - lastTime)
    lastTime = now
    if (fps is None):
        fps = (1.0 / dt)
    else:
        s = np.clip((dt * 3.0), 0, 1)
        fps = ((fps * (1 - s)) + ((1.0 / dt) * s))
    ui.fpsLabel.setText(('%0.2f fps' % fps))
    app.processEvents()