forked from M-Labs/artiq
1
0
Fork 0

gui: add image applet

This commit is contained in:
Sebastien Bourdeauducq 2016-03-23 17:04:22 +08:00
parent 168113ce55
commit befbab5571
2 changed files with 31 additions and 0 deletions

29
artiq/applets/image.py Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3.5
import numpy as np
import PyQt5 # make sure pyqtgraph imports Qt5
import pyqtgraph
from artiq.applets.simple import SimpleApplet
class Image(pyqtgraph.ImageView):
def __init__(self, args):
pyqtgraph.ImageView.__init__(self)
self.args = args
def data_changed(self, data, mods):
try:
img = data[self.args.img][1]
except KeyError:
return
self.setImage(img)
def main():
applet = SimpleApplet(Image)
applet.add_dataset("img", "image data (2D numpy array)")
applet.run()
if __name__ == "__main__":
main()

View File

@ -185,6 +185,8 @@ _templates = [
"--embed {ipc_address} X_DATASET "
"HIST_BIN_BOUNDARIES_DATASET "
"HISTS_COUNTS_DATASET"),
("Image", "{python} -m artiq.applets.image "
"--embed {ipc_address} IMG_DATASET"),
]