Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
461472c1
Commit
461472c1
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Little tweaks to gifti module
parent
93fe5076
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/gifti.py
+39
-38
39 additions, 38 deletions
fsl/data/gifti.py
with
39 additions
and
38 deletions
fsl/data/gifti.py
+
39
−
38
View file @
461472c1
...
...
@@ -51,7 +51,7 @@ class GiftiSurface(mesh.TriangleMesh):
def
__init__
(
self
,
infile
):
"""
Load the given GIFTI file using ``nibabel``, and extracts surface
data using the :func:`
extract
GiftiSurface` function.
data using the :func:`
load
GiftiSurface` function.
:arg infile: A GIFTI surface file (``*.surf.gii``).
...
...
@@ -71,7 +71,7 @@ class GiftiSurface(mesh.TriangleMesh):
self
.
surfImg
=
surfimg
def
loadVertexData
(
self
,
dataSource
):
def
loadVertexData
(
self
,
dataSource
,
vertexData
=
None
):
"""
Overrides the :meth:`.TriangleMesh.loadVertexData` method.
Attempts to load data associated with each vertex of this
...
...
@@ -79,12 +79,13 @@ class GiftiSurface(mesh.TriangleMesh):
a GIFTI file or a plain text file which contains vertex data.
"""
if
dataSource
.
endswith
(
'
.gii
'
):
vdata
=
loadGiftiVertexData
(
dataSource
)[
1
]
else
:
vdata
=
None
if
vertexData
is
None
:
if
dataSource
.
endswith
(
'
.gii
'
):
vertexData
=
loadGiftiVertexData
(
dataSource
)[
1
]
else
:
vertexData
=
None
return
mesh
.
TriangleMesh
.
loadVertexData
(
self
,
dataSource
,
v
d
ata
)
return
mesh
.
TriangleMesh
.
loadVertexData
(
self
,
dataSource
,
v
ertexD
ata
)
ALLOWED_EXTENSIONS
=
[
'
.surf.gii
'
,
'
.gii
'
]
...
...
@@ -208,35 +209,35 @@ def relatedFiles(fname):
share the same prefix are assumed to be related to the given file.
"""
try
:
# We want to return all files in the same
# directory which have the following name:
#
# [prefix].*.[type].gii
#
# where
# - prefix is the file prefix, and which
# may include periods.
#
# - we don't care about the middle
#
# - type is func, shape, label, or time
# We determine the unique prefix of the
# given file, and back-up to the most
# recent period. Then search for other
# files which have that same (non-unique)
# prefix.
prefix
=
fslpath
.
uniquePrefix
(
fname
)
prefix
=
prefix
[:
prefix
.
rfind
(
'
.
'
)]
funcs
=
glob
.
glob
(
'
{}*.func.gii
'
.
format
(
prefix
))
shapes
=
glob
.
glob
(
'
{}*.shape.gii
'
.
format
(
prefix
))
labels
=
glob
.
glob
(
'
{}*.label.gii
'
.
format
(
prefix
))
times
=
glob
.
glob
(
'
{}*.time.gii
'
.
format
(
prefix
))
return
funcs
+
shapes
+
labels
+
times
except
:
# We want to return all files in the same
# directory which have the following name:
#
# [prefix].*.[type].gii
#
# where
# - prefix is the file prefix, and which
# may include periods.
#
# - we don't care about the middle
#
# - type is func, shape, label, or time
# We determine the unique prefix of the
# given file, and back-up to the most
# recent period. Then search for other
# files which have that same (non-unique)
# prefix.
prefix
=
fslpath
.
uniquePrefix
(
fname
)
lastdot
=
prefix
.
rfind
(
'
.
'
)
prefix
=
prefix
[:
lastdot
]
if
lastdot
==
-
1
:
return
[]
funcs
=
list
(
glob
.
glob
(
'
{}*.func.gii
'
.
format
(
prefix
)))
shapes
=
list
(
glob
.
glob
(
'
{}*.shape.gii
'
.
format
(
prefix
)))
labels
=
list
(
glob
.
glob
(
'
{}*.label.gii
'
.
format
(
prefix
)))
times
=
list
(
glob
.
glob
(
'
{}*.time.gii
'
.
format
(
prefix
)))
return
funcs
+
shapes
+
labels
+
times
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment