Newer
Older

Paul McCarthy
committed
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
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
#
# freesurfer.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""
"""
import os.path as op
import nibabel as nib
import fsl.utils.path as fslpath
import fsl.data.mesh as fslmesh
class FreesurferMesh(fslmesh.TriangleMesh):
"""
"""
def __init__(self, filename):
"""
"""
vertices, indices, meta, comment = nib.freesurfer.read_geometry(
filename,
read_metadata=True,
read_stamp=True)
fslmesh.TriangleMesh.__init__(self, vertices, indices)
self.dataSource = op.abspath(filename)
self.name = fslpath.removeExt(op.basename(filename),
ALLOWED_EXTENSIONS)
def loadVertexData(self, dataSource, vertexData=None):
pass
ALLOWED_EXTENSIONS = ['.pial',
'.white',
'.sphere',
'.inflated',
'.orig',
'.sulc',
'.mid' ]
EXTENSION_DESCRIPTIONS = [
]
def relatedFiles(fname):
"""
"""
#
# .annot files contain labels for each vertex, and RGB values for each label
# -> nib.freesurfer.read_annot
#
# .label files contain scalar labels associated with each vertex
# -> read_label
#
# .curv files contain vertex data
# -> nib.freesurfer.read_morph_data
#
# .w files contain vertex data (potentially for a subset of vertices)
# -> ?
pass