Last active
January 20, 2016 16:51
-
-
Save astrofrog/aa1b4a490e61b82f9aa7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from PyQt4 import QtGui | |
qtapp = QtGui.QApplication(['']) | |
from vispy import app, scene, io | |
app.use_app() | |
from vispy.app.qt import QtSceneCanvas | |
vol = np.load(io.load_data_file('volume/stent.npz'))['arr_0'] | |
canvas = QtSceneCanvas(keys='interactive', size=(800, 600), | |
show=True) | |
view = canvas.central_widget.add_view() | |
volume = scene.visuals.Volume(vol, parent=view.scene) | |
volume.transform = scene.STTransform(translate=(64, 64, 0)) | |
view.camera = scene.cameras.TurntableCamera(parent=view.scene) | |
# Create main window | |
widget = QtGui.QMainWindow() | |
# Create MDI area | |
mdi = QtGui.QMdiArea() | |
widget.setCentralWidget(mdi) | |
# Create sub-window in MDI area with VisPy viewer | |
sub = QtGui.QMdiSubWindow() | |
sub.setWidget(canvas) | |
mdi.addSubWindow(sub) | |
widget.show() | |
qtapp.exec_() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment