Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD 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
FSL
fslpy
Commits
2aaf5fa9
Commit
2aaf5fa9
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Fixes to support loading of multiple vertex sets and data from one gifti file
parent
99cc593f
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
+18
-10
18 additions, 10 deletions
fsl/data/gifti.py
with
18 additions
and
10 deletions
fsl/data/gifti.py
+
18
−
10
View file @
2aaf5fa9
...
...
@@ -35,13 +35,13 @@ import fsl.data.constants as constants
import
fsl.data.mesh
as
fslmesh
ALLOWED_EXTENSIONS
=
[
'
.gii
'
]
ALLOWED_EXTENSIONS
=
[
'
.surf.gii
'
,
'
.gii
'
]
"""
List of file extensions that a file containing Gifti surface data
is expected to have.
"""
EXTENSION_DESCRIPTIONS
=
[
'
GIFTI file
'
]
EXTENSION_DESCRIPTIONS
=
[
'
GIFTII surface file
'
,
'
GIFTI file
'
]
"""
A description for each of the :data:`ALLOWED_EXTENSIONS`.
"""
...
...
@@ -83,8 +83,10 @@ class GiftiMesh(fslmesh.Mesh):
name
=
name
,
dataSource
=
infile
)
for
v
in
vertices
:
self
.
addVertices
(
v
,
infile
,
fixWinding
=
fixWinding
)
for
i
,
v
in
enumerate
(
vertices
):
if
i
==
0
:
key
=
infile
else
:
key
=
'
{} [{}]
'
.
format
(
infile
,
i
)
self
.
addVertices
(
v
,
key
,
select
=
(
i
==
0
),
fixWinding
=
fixWinding
)
self
.
setMeta
(
infile
,
surfimg
)
if
vdata
is
not
None
:
...
...
@@ -95,18 +97,21 @@ class GiftiMesh(fslmesh.Mesh):
# as the specfiied one.
if
loadAll
:
nvertices
=
vertices
.
shape
[
0
]
nvertices
=
vertices
[
0
]
.
shape
[
0
]
surfFiles
=
relatedFiles
(
infile
,
ALLOWED_EXTENSIONS
)
for
sfile
in
surfFiles
:
surfimg
,
vertices
,
_
=
loadGiftiMesh
(
sfile
)
try
:
surfimg
,
_
,
vertices
,
_
=
loadGiftiMesh
(
sfile
)
except
Exception
:
continue
if
vertices
.
shape
[
0
]
!=
nvertices
:
if
vertices
[
0
]
.
shape
[
0
]
!=
nvertices
:
continue
self
.
addVertices
(
vertices
,
sfile
,
select
=
False
)
self
.
setMeta
(
sfile
,
surfimg
)
self
.
addVertices
(
vertices
[
0
]
,
sfile
,
select
=
False
)
self
.
setMeta
(
sfile
,
surfimg
)
def
loadVertices
(
self
,
infile
,
key
=
None
,
*
args
,
**
kwargs
):
...
...
@@ -126,7 +131,7 @@ class GiftiMesh(fslmesh.Mesh):
if
key
is
None
:
key
=
infile
surfimg
,
vertices
,
_
=
loadGiftiMesh
(
infile
)
surfimg
,
_
,
vertices
,
_
=
loadGiftiMesh
(
infile
)
vertices
=
self
.
addVertices
(
vertices
,
key
,
*
args
,
**
kwargs
)
...
...
@@ -229,6 +234,9 @@ def loadGiftiVertexData(filename):
def
prepareGiftiVertexData
(
darrays
,
filename
=
None
):
"""
Prepares vertex data from the given list of GIFTI data arrays.
All of the data arrays are concatenated into one ``(M, N)`` array,
containing ``N`` data points for ``M`` vertices.
It is assumed that the given file does not contain any
``NIFTI_INTENT_POINTSET`` or ``NIFTI_INTENT_TRIANGLE`` data arrays, and
which contains either:
...
...
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