Skip to content
Snippets Groups Projects
Commit 15ecde79 authored by Paul McCarthy's avatar 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
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -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.
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment