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
66eb47f4
Commit
66eb47f4
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Freesurfer checks label and stats directories for vertex data
files. Adjustment to gifti.relatedFiles.
parent
f8a52e27
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/data/freesurfer.py
+14
-4
14 additions, 4 deletions
fsl/data/freesurfer.py
fsl/data/gifti.py
+17
-16
17 additions, 16 deletions
fsl/data/gifti.py
with
31 additions
and
20 deletions
fsl/data/freesurfer.py
+
14
−
4
View file @
66eb47f4
...
@@ -93,7 +93,6 @@ VERTEX_DATA_FILES = ['?h.thickness',
...
@@ -93,7 +93,6 @@ VERTEX_DATA_FILES = ['?h.thickness',
'
?h.curv
'
,
'
?h.curv
'
,
'
?h.area
'
,
'
?h.area
'
,
'
?h.sulc
'
,
'
?h.sulc
'
,
'
?h.*.stats
'
,
'
.mgh
'
,
'
.mgh
'
,
'
.mgz
'
]
'
.mgz
'
]
"""
File patterns which are interpreted as Freesurfer vertex data files,
"""
File patterns which are interpreted as Freesurfer vertex data files,
...
@@ -225,7 +224,7 @@ class FreesurferMesh(fslmesh.Mesh):
...
@@ -225,7 +224,7 @@ class FreesurferMesh(fslmesh.Mesh):
self
.
addVertexData
(
key
,
vdata
)
self
.
addVertexData
(
key
,
vdata
)
if
isv
label
:
if
isv
annot
:
self
.
__luts
[
key
]
=
lut
,
names
,
lut
self
.
__luts
[
key
]
=
lut
,
names
,
lut
return
vdata
return
vdata
...
@@ -368,9 +367,20 @@ def relatedVertexDataFiles(fname):
...
@@ -368,9 +367,20 @@ def relatedVertexDataFiles(fname):
fpats
=
VERTEX_DATA_FILES
+
VERTEX_LABEL_FILES
+
VERTEX_ANNOT_FILES
fpats
=
VERTEX_DATA_FILES
+
VERTEX_LABEL_FILES
+
VERTEX_ANNOT_FILES
fpats
=
[
hemi
+
p
[
1
:]
if
p
.
startswith
(
'
?h
'
)
else
p
for
p
in
fpats
]
fpats
=
[
hemi
+
p
[
1
:]
if
p
.
startswith
(
'
?h
'
)
else
p
for
p
in
fpats
]
related
=
[
glob
.
glob
(
op
.
join
(
dirname
,
p
))
for
p
in
fpats
]
basedir
=
op
.
dirname
(
dirname
)
searchDirs
=
set
([
dirname
,
op
.
join
(
basedir
,
'
surf
'
),
op
.
join
(
basedir
,
'
stats
'
),
op
.
join
(
basedir
,
'
label
'
)])
searchPats
=
it
.
product
(
searchDirs
,
fpats
)
related
=
[]
for
sdir
,
spat
in
searchPats
:
related
.
extend
(
glob
.
glob
(
op
.
join
(
sdir
,
spat
)))
return
list
(
it
.
chain
(
*
related
))
return
related
def
findReferenceImage
(
fname
):
def
findReferenceImage
(
fname
):
...
...
This diff is collapsed.
Click to expand it.
fsl/data/gifti.py
+
17
−
16
View file @
66eb47f4
...
@@ -77,6 +77,7 @@ class GiftiMesh(fslmesh.Mesh):
...
@@ -77,6 +77,7 @@ class GiftiMesh(fslmesh.Mesh):
surfimg
,
vertices
,
indices
=
loadGiftiMesh
(
infile
)
surfimg
,
vertices
,
indices
=
loadGiftiMesh
(
infile
)
fslmesh
.
Mesh
.
__init__
(
self
,
fslmesh
.
Mesh
.
__init__
(
self
,
indices
,
indices
,
name
=
name
,
name
=
name
,
...
@@ -278,35 +279,35 @@ def relatedFiles(fname, ftypes=None):
...
@@ -278,35 +279,35 @@ def relatedFiles(fname, ftypes=None):
# directory which have the following name:
# directory which have the following name:
#
#
# [
prefix
].*[ftype]
# [
subj].[hemi].[type
].*
.
[ftype]
#
#
# where
# where
# - prefix is the file prefix, and which
# - [subj] is the subject ID, and matches fname
# may include periods.
#
#
# -
we don't ca
re a
bout the middl
e
# -
[hemi] is the hemisphe
re
,
a
nd matches fnam
e
#
#
# -
suffix is func, shape, label, time, or `ftype`
# -
[type] defines the file contents
#
#
# - suffix is func, shape, label, time, or `ftype`
# We determine the unique prefix of the
path
=
op
.
abspath
(
fname
)
# given file, and back-up to the most
dirname
,
fname
=
op
.
split
(
path
)
# 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
:
# get the [subj].[hemi] prefix
try
:
subj
,
hemi
,
_
=
fname
.
split
(
'
.
'
,
2
)
prefix
=
'
.
'
.
join
((
subj
,
hemi
))
except
Exception
:
return
[]
return
[]
related
=
[]
related
=
[]
for
ftype
in
ftypes
:
for
ftype
in
ftypes
:
related
+=
list
(
glob
.
glob
(
'
{}*{}
'
.
format
(
prefix
,
ftype
)))
related
.
extend
(
glob
.
glob
(
op
.
join
(
dirname
,
'
{}*{}
'
.
format
(
prefix
,
ftype
))))
return
[
r
for
r
in
related
if
r
!=
fname
]
return
[
r
for
r
in
related
if
r
!=
path
]
class
GiftiSurface
(
fslmesh
.
TriangleMesh
):
class
GiftiSurface
(
fslmesh
.
TriangleMesh
):
...
...
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