pyqtgraph/examples/test_ImageView.py

31 lines
726 B
Python
Raw Normal View History

2010-03-22 05:48:52 +00:00
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
2010-03-22 05:48:52 +00:00
from pyqtgraph.ImageView import *
2010-03-22 05:48:52 +00:00
from numpy import random
from PyQt4 import QtCore, QtGui
from scipy.ndimage import *
app = QtGui.QApplication([])
## Create window with ImageView widget
2010-03-22 05:48:52 +00:00
win = QtGui.QMainWindow()
imv = ImageView()
win.setCentralWidget(imv)
win.show()
## Create random 3D data set
2010-03-22 05:48:52 +00:00
img = gaussian_filter(random.random((200, 200)), (5, 5)) * 5
data = random.random((100, 200, 200))
data += img
for i in range(data.shape[0]):
data[i] += exp(-(2.*i)/data.shape[0])
data += 10
## Display the data
imv.setImage(data)
app.exec_()