Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Evan Edmond
fslpy
Commits
15ecde79
Commit
15ecde79
authored
Feb 15, 2017
by
Paul McCarthy
Browse files
TriangleMesh/GiftiSurface classes have method to load vertex data. I/O will be
kept in these classes, instead of in FSLeyes.
parent
b6e191b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
fsl/data/gifti.py
View file @
15ecde79
...
...
@@ -23,6 +23,8 @@ are available:
import
os.path
as
op
import
nibabel
as
nib
import
fsl.utils.path
as
fslpath
from
.
import
mesh
...
...
@@ -50,7 +52,6 @@ class GiftiSurface(mesh.TriangleMesh):
:arg infile: A GIFTI surface file
"""
import
nibabel
as
nib
surfimg
=
nib
.
load
(
infile
)
vertices
,
indices
=
extractGiftiSurface
(
surfimg
)
...
...
@@ -65,6 +66,16 @@ class GiftiSurface(mesh.TriangleMesh):
self
.
surfImg
=
surfimg
def
loadVertexData
(
self
,
dataSource
):
"""Attempts to load scalar data associated with each vertex of this
``GiftiSurface`` from the given ``dataSource``.
"""
# TODO make this more robust
norms
=
nib
.
load
(
dataSource
)
return
norms
.
darrays
[
0
].
data
ALLOWED_EXTENSIONS
=
[
'.surf.gii'
,
'.gii'
]
"""List of file extensions that a file containing Gifti surface data
is expected to have.
...
...
fsl/data/mesh.py
View file @
15ecde79
...
...
@@ -55,6 +55,14 @@ class TriangleMesh(object):
the vertex indices for :math:`M` triangles
============== ====================================================
And the following methods:
.. autosummary::
:nosignatures:
getBounds
loadVertexData
"""
...
...
@@ -117,6 +125,15 @@ class TriangleMesh(object):
return
(
self
.
__loBounds
,
self
.
__hiBounds
)
def
loadVertexData
(
self
,
dataSource
):
"""Attempts to load scalar data associated with each vertex of this
``TriangleMesh`` from the given ``dataSource``.
This method may be overridden by sub-classes.
"""
raise
NotImplementedError
(
'Not implemented yet'
)
ALLOWED_EXTENSIONS
=
[
'.vtk'
]
"""A list of file extensions which could contain :class:`TriangleMesh` data.
"""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment