2010-03-22 05:48:52 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2010-03-22 06:21:56 +00:00
|
|
|
## 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
|
|
|
|
2010-03-22 06:21:56 +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([])
|
2010-03-22 06:21:56 +00:00
|
|
|
|
|
|
|
## Create window with ImageView widget
|
2010-03-22 05:48:52 +00:00
|
|
|
win = QtGui.QMainWindow()
|
|
|
|
imv = ImageView()
|
|
|
|
win.setCentralWidget(imv)
|
|
|
|
win.show()
|
|
|
|
|
2010-03-22 06:21:56 +00:00
|
|
|
## 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
|
2010-03-22 06:21:56 +00:00
|
|
|
|
|
|
|
## Display the data
|
|
|
|
imv.setImage(data)
|
|
|
|
|
|
|
|
app.exec_()
|