forked from nipy/PySurfer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpysurfer_test.py
63 lines (53 loc) · 1.74 KB
/
pysurfer_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /usr/bin/env python
import os
import sys
from os.path import join as pjoin
from enthought.mayavi import mlab
import pysurfer as ps
import random
mlab.options.offscreen = False
f = mlab.figure(random.randint(0,1000), bgcolor=(253./256,246./256,227./256), size=(800,800))
mlab.clf()
f.scene.disable_render = False
data_dir = os.environ["SUBJECTS_DIR"]
sub = "fsaverage"
hemi = "lh"
sur = "inflated"
surf = ps.FSBrain(sub, hemi,sur)
#print "Loading geometry"
#surf.load_geometry(pjoin(data_dir, subject, "surf", "%s.%s"%(hemi,surface)))
#surf.load_curvature(pjoin(data_dir, subject, "surf", "%s.curv"%hemi))
#surface_mesh = surf.get_mesh()
#brain = mlab.pipeline.surface(surface_mesh, colormap="Greys", vmin=-.5, vmax=1.5)
#bar = mlab.scalarbar()
#bar.reverse_lut =True
#bar.visible=False
# stats = ps.Surface()
# print "Loading statistic overlay"
# stats.load_scalar_data(sys.argv[1])
# stats_mesh = mlab.pipeline.triangular_mesh_source(surf.x,
# surf.y,
# surf.z,
# surf.faces,
# scalars=stats.scalar_data)
#thresh = mlab.pipeline.threshold(stats_mesh, low=2.3)
#stats_surf = mlab.pipeline.surface(thresh,colormap="hot")
#bar = mlab.scalarbar(stats_surf)
#print "Writing snapshots"
#mlab.view(180,0)
for i in range(360):
mlab.view(i,90)
# for view in ["lat", "post", "med", "ant"]:
# mlab.draw()
# mlab.savefig("test-%s.png"%view)
# f.scene.camera.azimuth(90)
"""
mlab.savefig("test-lat.png")
mlab.view(270,90)
mlab.savefig("test-post.png")
mlab.view(0,90)
mlab.savefig("test-med.png")
mlab.view(90,90)
mlab.savefig("test-ant.png")
"""
#mlab.close(all=True)