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
FSL
fslpy
Commits
16a98f34
Commit
16a98f34
authored
Apr 18, 2017
by
Paul McCarthy
Browse files
isFEATImage and isMelodicImage functions cleaned up. Adjustements to other
melodicanalysis functions - .gica suffix no longer recognised.
parent
1d8aba54
Changes
2
Hide whitespace changes
Inline
Side-by-side
fsl/data/featanalysis.py
View file @
16a98f34
...
...
@@ -70,9 +70,7 @@ def isFEATImage(path):
dirname
=
op
.
dirname
(
path
)
filename
=
op
.
basename
(
path
)
return
filename
.
startswith
(
'filtered_func_data'
)
and
\
fslimage
.
looksLikeImage
(
filename
)
and
\
isFEATDir
(
dirname
)
return
filename
.
startswith
(
'filtered_func_data'
)
and
isFEATDir
(
dirname
)
def
isFEATDir
(
path
):
...
...
fsl/data/melodicanalysis.py
View file @
16a98f34
...
...
@@ -46,19 +46,23 @@ def isMelodicImage(path):
component image file, ``False`` otherwise.
"""
try
:
path
=
fslimage
.
addExt
(
path
,
mustExist
=
True
)
except
:
return
False
dirname
=
op
.
dirname
(
path
)
filename
=
op
.
basename
(
path
)
return
fslimage
.
removeExt
(
filename
)
==
'melodic_IC'
and
\
isMelodicDir
(
dirname
)
return
filename
.
startswith
(
'melodic_IC'
)
and
isMelodicDir
(
dirname
)
def
isMelodicDir
(
path
):
"""Returns ``True`` if the given path looks like it is contained within
a MELODIC directory, ``False`` otherwise. A melodic directory:
- Must be named ``*.ica``
or ``*.gica``
.
- Must be named ``*.ica``.
- Must contain a file called ``melodic_IC.nii.gz``.
- Must contain a file called ``melodic_mix``.
- Must contain a file called ``melodic_FTmix``.
...
...
@@ -69,7 +73,7 @@ def isMelodicDir(path):
if
op
.
isdir
(
path
):
dirname
=
path
else
:
dirname
=
op
.
dirname
(
path
)
sufs
=
[
'.ica'
,
'.gica'
]
sufs
=
[
'.ica'
]
if
not
any
([
dirname
.
endswith
(
suf
)
for
suf
in
sufs
]):
return
False
...
...
@@ -93,7 +97,7 @@ def getAnalysisDir(path):
to that MELODIC directory is returned. Otherwise, ``None`` is returned.
"""
meldir
=
fslpath
.
deepest
(
path
,
[
'.ica'
,
'.gica'
])
meldir
=
fslpath
.
deepest
(
path
,
[
'.ica'
])
if
meldir
is
not
None
and
isMelodicDir
(
meldir
):
return
meldir
...
...
@@ -140,12 +144,18 @@ def getICFile(meldir):
def
getMixFile
(
meldir
):
"""Returns the path to the melodic mix file. """
return
op
.
join
(
meldir
,
'melodic_mix'
)
mixfile
=
op
.
join
(
meldir
,
'melodic_mix'
)
if
op
.
exists
(
mixfile
):
return
mixfile
else
:
return
None
def
getFTMixFile
(
meldir
):
"""Returns the path to the melodic FT mix file. """
return
op
.
join
(
meldir
,
'melodic_FTmix'
)
ftmixfile
=
op
.
join
(
meldir
,
'melodic_FTmix'
)
if
op
.
exists
(
ftmixfile
):
return
ftmixfile
else
:
return
None
def
getReportFile
(
meldir
):
...
...
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