Skip to content

merge #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 130 commits into from
Oct 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
b5ae9c7
initial vertexrois: now rois.py/ROIpack can be used to generate an SV…
alexhuth Sep 10, 2013
4d5b082
Merge branch 'master' into vertexrois
Oct 17, 2013
6537af0
Minor change to cortex/rois.py to make explicit that cache should be …
Oct 17, 2013
b262499
First steps to making sulcal / display layers on webgl viewer.
marklescroart Apr 30, 2014
9de4aa7
Can save sulcal layers as separate ctm (so you choose whether to disp…
marklescroart May 2, 2014
e5a63c2
Updates to extra_layers. Also playing with animation stuff in view.py…
marklescroart May 14, 2014
fdbe317
Quick attempt to make quickflat work with rois
marklescroart May 17, 2014
472e509
adding svgroi+svgsplines
BaladityaY Jun 6, 2014
91df942
First steps to making sulcal / display layers on webgl viewer.
marklescroart Apr 30, 2014
2fc9128
Can save sulcal layers as separate ctm (so you choose whether to disp…
marklescroart May 2, 2014
4b2d872
Updates to extra_layers. Also playing with animation stuff in view.py…
marklescroart May 14, 2014
8b33f2b
Couple stoopid bugs in rebase of branch to master fixed.
marklescroart Jun 6, 2014
2e0e9ae
More stoopid fixes w/ merge w/ master branch.
marklescroart Jun 6, 2014
68b1d90
Final cleanup of merge/rebase nonsense. I hope.
marklescroart Jun 11, 2014
c8b07b1
Laptop updates to add extra_disp layer
marklescroart Jun 11, 2014
26c98f5
Merge branch 'extra_layers' of https://github.com/gallantlab/pycortex…
marklescroart Jun 11, 2014
f8b0299
Merge branch 'extra_layers' of https://github.com/gallantlab/pycortex…
marklescroart Jun 11, 2014
134754e
First steps to making sulcal / display layers on webgl viewer.
marklescroart Apr 30, 2014
8785696
Can save sulcal layers as separate ctm (so you choose whether to disp…
marklescroart May 2, 2014
19a8b8a
Updates to extra_layers. Also playing with animation stuff in view.py…
marklescroart May 14, 2014
b9990ff
Quick attempt to make quickflat work with rois
marklescroart May 17, 2014
f0dc55a
First steps to making sulcal / display layers on webgl viewer.
marklescroart Apr 30, 2014
07fea84
Can save sulcal layers as separate ctm (so you choose whether to disp…
marklescroart May 2, 2014
0a5741d
Updates to extra_layers. Also playing with animation stuff in view.py…
marklescroart May 14, 2014
6d15652
Couple stoopid bugs in rebase of branch to master fixed.
marklescroart Jun 6, 2014
9f1cc52
More stoopid fixes w/ merge w/ master branch.
marklescroart Jun 6, 2014
2bf681a
Final cleanup of merge/rebase nonsense. I hope.
marklescroart Jun 11, 2014
9fd3028
Laptop updates to add extra_disp layer
marklescroart Jun 11, 2014
de5fd1f
Misc fiddlings with memo function to debug, final fix of quickflat af…
marklescroart Jun 11, 2014
dcc0ee5
Changes to get/set views, for incorporation back to master branch
marklescroart Jun 13, 2014
7db6ab4
Updates to quicklflat and blah I don't know need to change back to ma…
marklescroart Jul 15, 2014
4fde5f4
Merge branch 'extra_layers' of https://github.com/gallantlab/pycortex…
marklescroart Aug 12, 2014
58a55ed
First steps to making sulcal / display layers on webgl viewer.
marklescroart Apr 30, 2014
cbea32f
Can save sulcal layers as separate ctm (so you choose whether to disp…
marklescroart May 2, 2014
2cd1d15
Updates to extra_layers. Also playing with animation stuff in view.py…
marklescroart May 14, 2014
8293b57
Quick attempt to make quickflat work with rois
marklescroart May 17, 2014
10c731a
First steps to making sulcal / display layers on webgl viewer.
marklescroart Apr 30, 2014
0a0a2cf
Can save sulcal layers as separate ctm (so you choose whether to disp…
marklescroart May 2, 2014
e923bc5
Updates to extra_layers. Also playing with animation stuff in view.py…
marklescroart May 14, 2014
1366aa0
Couple stoopid bugs in rebase of branch to master fixed.
marklescroart Jun 6, 2014
e6047b2
Final cleanup of merge/rebase nonsense. I hope.
marklescroart Jun 11, 2014
56fac54
Laptop updates to add extra_disp layer
marklescroart Jun 11, 2014
ec6c017
First steps to making sulcal / display layers on webgl viewer.
marklescroart Apr 30, 2014
bd53864
Can save sulcal layers as separate ctm (so you choose whether to disp…
marklescroart May 2, 2014
84e79b7
Updates to extra_layers. Also playing with animation stuff in view.py…
marklescroart May 14, 2014
8d328aa
Quick attempt to make quickflat work with rois
marklescroart May 17, 2014
6af2249
First steps to making sulcal / display layers on webgl viewer.
marklescroart Apr 30, 2014
6776d2a
Can save sulcal layers as separate ctm (so you choose whether to disp…
marklescroart May 2, 2014
247070b
Laptop updates to add extra_disp layer
marklescroart Jun 11, 2014
029d029
Misc fiddlings with memo function to debug, final fix of quickflat af…
marklescroart Jun 11, 2014
801c6c2
Changes to get/set views, for incorporation back to master branch
marklescroart Jun 13, 2014
e607ff2
Updates to quicklflat and blah I don't know need to change back to ma…
marklescroart Jul 15, 2014
a5a8d6d
Tiny modifications to help of make_static after rebase of extra_layer…
marklescroart Aug 12, 2014
53539fa
Merge branch 'extra_layers' of https://github.com/gallantlab/pycortex…
marklescroart Aug 12, 2014
c19aaae
intermediate update of extra_layers branch to create multiple layers …
marklescroart Aug 14, 2014
11fa1de
Merge branch 'extra_layers_v2' into extra_layers
alexhuth Aug 14, 2014
e62c932
Merge branch 'master' into extra_layers
alexhuth Aug 14, 2014
9eb95e4
Merge branch 'master' into extra_layers
alexhuth Aug 14, 2014
4aa9843
Merge branch 'master' into extra_layers
alexhuth Aug 14, 2014
dc501cf
Update to have svg file in ctm pack have multiple layers
marklescroart Aug 14, 2014
4b31809
Merge branch 'extra_layers' of https://github.com/gallantlab/pycortex…
alexhuth Aug 14, 2014
a2715fa
fixed bugs in quickflat
alexhuth Aug 14, 2014
ab9951a
fixed handling of multi-path elements; turned off fancy label placeme…
alexhuth Sep 4, 2014
26ef389
fixed conflicts
alexhuth Sep 4, 2014
d8a447e
fuck, actually fixed merge
alexhuth Sep 4, 2014
9d552e1
Merge pull request #106 from andrewolaughlin/master
jamesgao Sep 10, 2014
a4b5170
now webgl works nicely with multiple display layers
alexhuth Sep 11, 2014
22f74f5
fixed bug that broke CTM for HCP subject
alexhuth Sep 14, 2014
389c642
fixed setstate for frame, maybe
alexhuth Sep 15, 2014
9ddeaa5
Merge branch 'master' of https://github.com/jamesgao/pycortex
alexhuth Sep 15, 2014
3b9ef0e
added keyboard shortcut for data display ('d')
alexhuth Sep 15, 2014
c4d4a82
fixed bug where calling VolumeRGB.volume multiple times would give di…
alexhuth Sep 16, 2014
3ff9b39
Cleaned up code all over the place; webgl viewer respects view option…
alexhuth Sep 18, 2014
a283110
added display options to make_static
alexhuth Sep 18, 2014
9ba904c
Merge pull request #107 from gallantlab/extra_layers
alexhuth Sep 18, 2014
06aefd8
NF: Add gifti surface to blender
anwarnunez Sep 18, 2014
f749c5f
Merge branch 'master' of https://github.com/jamesgao/pycortex
anwarnunez Sep 18, 2014
e707562
Fix to correctly handle multi-part paths in svgroi.py
marklescroart Sep 19, 2014
da8a64e
added OSX and vim crap to gitignore
alexhuth Sep 19, 2014
5b6f2b8
Allow pycortex colormap names to be used for quickflat
marklescroart Sep 24, 2014
6264316
Merge branch 'master' of https://github.com/gallantlab/pycortex
marklescroart Sep 24, 2014
622a863
Fix quickflat sizing in ipython notebook
jamesgao Sep 24, 2014
dc76ed7
Merge branch 'master' of github.com:jamesgao/pycortex
jamesgao Sep 24, 2014
9179b75
(re-)added ability to use external .svg files to display arbitrary la…
marklescroart Sep 25, 2014
16767af
Merge branch 'master' of https://github.com/gallantlab/pycortex
marklescroart Sep 25, 2014
23e37ae
added flipped RdBu_2D colormap
alexhuth Sep 25, 2014
129a1ec
Make vmin/vmax override Volumes in Volume2D
jamesgao Sep 25, 2014
de8c56f
2D colormap support for quickflat
jamesgao Sep 25, 2014
008b1e1
final get_roi with spline classes
BaladityaY Sep 25, 2014
bfb8d60
final get_roi + spline classes w/ updated comments
BaladityaY Sep 25, 2014
8153414
Fixed minor bug w/ new colormap code
marklescroart Sep 26, 2014
9636aa7
Merge branch 'master' of https://github.com/gallantlab/pycortex
marklescroart Sep 26, 2014
2cb0dce
First steps to re-coding animation
marklescroart Sep 29, 2014
fc5fdd3
Make saveIMG use getImage
Sep 29, 2014
0fb3bbd
attempts to fix saveIMG, aborted in favor of James' help.
Sep 29, 2014
2199216
Merge with JG changes
Sep 29, 2014
9550109
Further improvements to animation sequence. _get_anim_seq() now works.
Sep 29, 2014
c09ec1f
Add a marching_cubes function to pycortex
jamesgao Sep 29, 2014
d219892
Additions to allow external display files displayed on webgl surfaces
Sep 29, 2014
53915ee
A few changes to getState in mriview.js
Sep 30, 2014
3399860
Add slice setting to getState / setState
Sep 30, 2014
dfedcee
New colormap
marklescroart Sep 30, 2014
bb4bf40
Fix animation bug
jamesgao Oct 1, 2014
eac403c
New colormap
marklescroart Oct 1, 2014
09263ca
Merging changes
marklescroart Oct 1, 2014
60de3bb
Fix to missing last-frame of animations
marklescroart Oct 1, 2014
1ae8989
Merge branch 'master' of https://github.com/gallantlab/pycortex
alexhuth Oct 1, 2014
3a60735
fixed problem with adjacency matrix
alexhuth Oct 7, 2014
8306706
Merge branch 'master' of https://github.com/gallantlab/pycortex
alexhuth Oct 7, 2014
c4d5add
Merge branch 'master' of https://github.com/gallantlab/pycortex
alexhuth Oct 8, 2014
861ac89
integrated get_roi() with current pycortex
BaladityaY Oct 8, 2014
6879e5f
added all back?
BaladityaY Oct 8, 2014
61b1b66
fixed get_roi() with current pycortex
BaladityaY Oct 8, 2014
65a65a1
removed unnecessary comments
BaladityaY Oct 8, 2014
059c92e
Merge branch 'master' of https://github.com/gallantlab/pycortex
BaladityaY Oct 8, 2014
176b7c2
fixed merge conflicts
BaladityaY Oct 8, 2014
9ef5af7
removed useless files?
BaladityaY Oct 8, 2014
b9aadf1
added ability to input custom dropout map to quickflat
alexhuth Oct 14, 2014
cbf2240
added ability to rotate brain into canonical (90 degree) views using …
alexhuth Oct 14, 2014
6925009
fixed svg parser close path command bug
BaladityaY Oct 14, 2014
37cdad4
correct saving of orthographic views
marklescroart Oct 14, 2014
0783975
Merge pull request #109 from gallantlab/vertexrois
jamesgao Oct 14, 2014
a39164e
Prefer new name for new function
jamesgao Oct 14, 2014
bc829d4
Merge pull request #110 from gallantlab/animation_edits
jamesgao Oct 14, 2014
3f6268d
Fixed bug in face area computation
alexhuth Oct 17, 2014
6b6e38f
Fixed default m with new fixed triangle areas
alexhuth Oct 17, 2014
7abb176
Cast user-supplied masks to boolean arrays
alexhuth Oct 17, 2014
b1085a5
Removed all import *'s from svgroi.py............. (these are passive…
alexhuth Oct 17, 2014
d5ec03c
fixed colorpickers so defaults work w/ new version of minicolors
alexhuth Oct 17, 2014
a5f75e3
Merge branch 'master' of https://github.com/gallantlab/pycortex
alexhuth Oct 17, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ nosetests.xml
.mr.developer.cfg
.project
.pydevproject

# OS X bullshit
.DS_store

# vim temp files
*~
127 changes: 127 additions & 0 deletions cortex/blender.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import os
import struct
import numpy as np
from matplotlib import cm, colors

import bpy.ops
from bpy import context as C
from bpy import data as D

def make_object(pts, polys, name="mesh"):
mesh = D.meshes.new(name)
mesh.from_pydata(pts.tolist(), [], polys.tolist())
obj = D.objects.new(name, mesh)
C.scene.objects.link(obj)
return obj, mesh

def add_vcolor(color, mesh=None, name='color', cmap=cm.RdBu, vmin=None, vmax=None):
if mesh is None:
mesh = C.scene.objects.active.data
elif isinstance(mesh, str):
mesh = D.meshes[mesh]

bpy.ops.object.mode_set(mode='OBJECT')
if color.ndim == 1:
if vmin is None:
vmin = color.min()
if vmax is None:
vmax = color.max()
color = cmap((color - vmin) / (vmax - vmin))[:,:3]

loopidx = np.zeros((len(mesh.loops),), dtype=np.uint32)
mesh.loops.foreach_get('vertex_index', loopidx)

vcolor = mesh.vertex_colors.new(name)
for i, j in enumerate(loopidx):
vcolor.data[i].color = list(color[j])
return vcolor

def add_shapekey(shape, name=None):
bpy.ops.object.shape_key_add()
key = D.shape_keys[-1].key_blocks[-1]
if name is not None:
key.name = name

for i in range(len(key.data)):
key.data[i].co = shape[i]
return key

def cut_data(volumedata, name="retinotopy", projection="nearest", cmap=cm.RdBu, vmin=None, vmax=None, mesh="hemi"):
if isinstance(mesh, str):
mesh = D.meshes[mesh]

mapped = volumedata.map(projection)
if mapped.llen == len(mesh.vertices):
print("left hemisphere")
vcolor = mapped.left
else:
print ("right hemisphere")
vcolor = mapped.right

return add_vcolor(vcolor, mesh=mesh, name=name, cmap=cmap, vmin=vmin, vmax=vmax)

def fs_cut(subject, hemi):
from .freesurfer import get_surf
wpts, polys, curv = get_surf(subject, hemi, 'smoothwm')
ipts, _, _ = get_surf(subject, hemi, 'inflated')

obj, mesh = make_object(wpts, polys, name='hemi')
obj.scale = .1, .1, .1
C.scene.objects.active = obj
bpy.ops.object.shape_key_add()
add_vcolor(curv, mesh, vmin=-.6, vmax=.6, name='curvature')
add_shapekey(ipts, name='inflated')
obj.use_shape_key_edit_mode = True
return mesh

def write_patch(subject, hemi, name, mesh='hemi'):
from .freesurfer import get_paths, write_patch
if isinstance(mesh, str):
mesh = D.meshes[mesh]

bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
C.tool_settings.mesh_select_mode = False, True, False
bpy.ops.mesh.select_non_manifold()
bpy.ops.object.mode_set(mode='OBJECT')

mwall_edge = set()
for edge in mesh.edges:
if edge.select:
mwall_edge.add(edge.vertices[0])
mwall_edge.add(edge.vertices[1])

bpy.ops.object.mode_set(mode='EDIT')
C.tool_settings.mesh_select_mode = True, False, False
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')
seam = set()
for edge in mesh.edges:
if edge.use_seam:
seam.add(edge.vertices[0])
seam.add(edge.vertices[1])
edge.select = True

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_more()
bpy.ops.object.mode_set(mode='OBJECT')
smore = set()
for i, vert in enumerate(mesh.vertices):
if vert.select:
smore.add(i)

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')

fverts = set()
for face in mesh.polygons:
fverts.add(face.vertices[0])
fverts.add(face.vertices[1])
fverts.add(face.vertices[2])

edges = mwall_edge | (smore - seam)
verts = fverts - seam
pts = [(v, D.shape_keys['Key'].key_blocks['inflated'].data[v].co) for v in verts]
write_patch(get_paths(subject, hemi).format(name=name), pts, edges)
36 changes: 35 additions & 1 deletion cortex/blender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,39 @@ def add_cutdata(fname, dataview, name="retinotopy", projection="nearest", mesh="

return


def gii_cut(fname, subject, hemi):
'''
Add gifti surface to blender
'''
from ..database import db
hemis = dict(lh='left',
rh='right')

wpts, polys = db.get_surf(subject, 'wm', hemi)
ipts, _ = db.get_surf(subject, 'very_inflated', hemi)
curvature = db.getSurfInfo(subject, 'curvature')
rcurv = curvature.__getattribute__(hemis[hemi])

p = xdrlib.Packer()
p.pack_array(wpts.ravel(), p.pack_double)
p.pack_array(ipts.ravel(), p.pack_double)
p.pack_array(polys.ravel(), p.pack_uint)
p.pack_array(rcurv.ravel(), p.pack_double)
with tempfile.NamedTemporaryFile() as tf:
tf.write(p.get_buffer())
tf.flush()
code = """with open('{tfname}', 'rb') as fp:
u = xdrlib.Unpacker(fp.read())
wpts = u.unpack_array(u.unpack_double)
ipts = u.unpack_array(u.unpack_double)
polys = u.unpack_array(u.unpack_uint)
curv = u.unpack_array(u.unpack_double)
blendlib.init_subject(wpts, ipts, polys, curv)
""".format(tfname=tf.name)
_call_blender(fname, code)


def fs_cut(fname, subject, hemi):
wpts, polys, curv = freesurfer.get_surf(subject, hemi, 'smoothwm')
ipts, _, _ = freesurfer.get_surf(subject, hemi, 'inflated')
Expand Down Expand Up @@ -109,4 +142,5 @@ def write_patch(bname, pname, mesh="hemi"):
mesh = u.unpack_string().decode('utf-8')
blendlib.save_patch(pname, mesh)
""".format(tfname=tf.name)
_call_blender(bname, code)
_call_blender(bname, code)

79 changes: 54 additions & 25 deletions cortex/brainctm.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,23 @@ def addCurvature(self, **kwargs):
self.left.aux[:,1] = npz.left
self.right.aux[:,1] = npz.right

def save(self, path, method='mg2', **kwargs):
def save(self, path, method='mg2', disp_layers=['rois'], extra_disp=None, **kwargs):
"""Save CTM file for static html display.

Parameters
----------
path : string filepath
method : idkwtf
disp_layers : tuple|list
list of strings; names of layers from rois.svg to show
extra_disp : tuple
(svgfile,[layers]) - tuple of (external display .svg filename, [list_of,layers_in_file,to_display])
"""
ctmname = path+".ctm"
svgname = path+".svg"
jsname = path+".json"
#ptmapname = path+".npz"

##### Save CTM concatenation
# Save CTM concatenation
(lpts, _, _), lbin = self.left.save(method=method, **kwargs)
(rpts, _, _), rbin = self.right.save(method=method, **kwargs)

Expand All @@ -105,50 +115,62 @@ def save(self, path, method='mg2', **kwargs):
offsets.append(fp.tell())
fp.write(rbin)

##### Save the JSON descriptor
jsdict = dict(rois=os.path.split(svgname)[1], data=os.path.split(ctmname)[1], names=self.types,
materials=[], offsets=offsets)
# Save the JSON descriptor | Need to add to this for extra_disp?
jsdict = dict(rois=os.path.split(svgname)[1],
data=os.path.split(ctmname)[1],
names=self.types,
materials=[],
offsets=offsets)
if self.flatlims is not None:
jsdict['flatlims'] = self.flatlims
json.dump(jsdict, open(jsname, 'w'))

##### Compute and save the index map
# Compute and save the index map
if method != 'raw':
ptmap, inverse = [], []
for hemi, pts in zip([self.left, self.right], [lpts, rpts]):
kdt = cKDTree(hemi.pts)
diff, idx = kdt.query(pts)
ptmap.append(idx)
inverse.append(idx.argsort())

# np.savez(ptmapname, left=ptmap[0], right=ptmap[1])
else:
ptmap = inverse = np.arange(len(self.left.ctm)), np.arange(len(self.right.ctm))

##### Save the SVG with remapped indices
# Save the SVG with remapped indices (map 2D flatmap locations to vertices)
if self.left.flat is not None:
# add sulci & display layers
flatpts = np.vstack([self.left.flat, self.right.flat])
roipack = db.get_overlay(self.subject, pts=flatpts)
layer = roipack.setup_labels()
roipack = db.get_overlay(self.subject, pts=flatpts, otype=disp_layers)
# optionally add extra display layers
if not extra_disp is None:
esvgfile,elayerlist = extra_disp
eroipack = db.get_overlay(self.subject,pts=flatpts, otype='external',
svgfile=esvgfile,layer=elayerlist)
roipack = roipack + eroipack
layers = roipack.setup_labels()
if not isinstance(layers, (tuple, list)):
layers = (layers,)

# assign coordinates in left hemisphere negative values
with open(svgname, "w") as fp:
for element in layer.findall(".//{http://www.w3.org/2000/svg}text"):
idx = int(element.attrib["data-ptidx"])
if idx < len(inverse[0]):
idx = inverse[0][idx]
else:
idx -= len(inverse[0])
idx = inverse[1][idx] + len(inverse[0])
element.attrib["data-ptidx"] = str(idx)
for layer in layers:
for element in layer.findall(".//{http://www.w3.org/2000/svg}text"):
idx = int(element.attrib["data-ptidx"])
if idx < len(inverse[0]):
idx = inverse[0][idx]
else:
idx -= len(inverse[0])
idx = inverse[1][idx] + len(inverse[0])
element.attrib["data-ptidx"] = str(idx)
fp.write(roipack.toxml())

return ptmap

class Hemi(object):
def __init__(self, pts, polys, norms=None):
self.tf = tempfile.NamedTemporaryFile()
self.ctm = CTMfile(self.tf.name, "w")

self.ctm.setMesh(pts.astype(np.float32), polys, norms=norms)
self.ctm.setMesh(pts.astype(np.float32), polys.astype(np.uint32), norms=norms)

self.pts = pts
self.polys = polys
Expand Down Expand Up @@ -216,7 +238,10 @@ def setFlat(self, pts):
def addSurf(self, pts, **kwargs):
super(DecimatedHemi, self).addSurf(pts[self.mask], **kwargs)

def make_pack(outfile, subj, types=("inflated",), method='raw', level=0, decimate=False):
def make_pack(outfile, subj, types=("inflated",), method='raw', level=0,
decimate=False, disp_layers=['rois'],extra_disp=None):
"""Generates a cached CTM file"""

ctm = BrainCTM(subj, decimate=decimate)
ctm.addCurvature()
for name in types:
Expand All @@ -225,7 +250,11 @@ def make_pack(outfile, subj, types=("inflated",), method='raw', level=0, decimat
if not os.path.exists(os.path.split(outfile)[0]):
os.makedirs(os.path.split(outfile)[0])

return ctm.save(os.path.splitext(outfile)[0], method=method, level=level)
return ctm.save(os.path.splitext(outfile)[0],
method=method,
level=level,
disp_layers=disp_layers,
extra_disp=extra_disp)

def read_pack(ctmfile):
fname = os.path.splitext(ctmfile)[0]
Expand All @@ -247,4 +276,4 @@ def read_pack(ctmfile):
pts, polys, norms = ctm.getMesh()
meshes.append((pts, polys))

return meshes
return meshes
Loading