Skip to content

Instantly share code, notes, and snippets.

@thewtex
Created August 9, 2013 04:04
Show Gist options
  • Save thewtex/6191109 to your computer and use it in GitHub Desktop.
Save thewtex/6191109 to your computer and use it in GitHub Desktop.
View tubes with TubeTK/PyQtGraph
#!/usr/bin/env python
import sys
import tubetk
from tubetk.numpy import tubes_from_file
from tubetk.pyqtgraph import tubes_as_circles
import pyqtgraph as pg
import pyqtgraph.opengl as gl
if len(sys.argv) < 2:
print('Usage: view-tubes.py <tubes.tre>')
sys.exit(1)
tubes_filepath = sys.argv[1]
app = pg.mkQApp()
view = gl.GLViewWidget()
axis = gl.GLAxisItem()
view.addItem(axis)
tubes = tubes_from_file(tubes_filepath)
circles = tubes_as_circles(tubes)
circles_mesh = gl.GLMeshItem(meshdata=circles, smooth=False)
view.addItem(circles_mesh)
view.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment