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
4fb33a00
Commit
4fb33a00
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Melodic analysis is detected if either melodic_IC or melodic_oIC are present
parent
13d87165
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/melodicanalysis.py
+23
-9
23 additions, 9 deletions
fsl/data/melodicanalysis.py
fsl/data/melodicimage.py
+1
-1
1 addition, 1 deletion
fsl/data/melodicimage.py
with
24 additions
and
10 deletions
fsl/data/melodicanalysis.py
+
23
−
9
View file @
4fb33a00
...
...
@@ -48,14 +48,18 @@ def isMelodicImage(path):
try
:
path
=
fslimage
.
addExt
(
path
,
mustExist
=
True
)
path
=
fslimage
.
addExt
(
path
)
except
fslimage
.
PathError
:
return
False
dirname
=
op
.
dirname
(
path
)
filename
=
op
.
basename
(
path
)
filename
=
fslimage
.
removeExt
(
filename
)
return
filename
.
startswith
(
'
melodic_IC
'
)
and
isMelodicDir
(
dirname
)
prefixes
=
[
'
melodic_IC
'
,
'
melodic_oIC
'
]
return
any
([
filename
==
p
for
p
in
prefixes
])
and
isMelodicDir
(
dirname
)
def
isMelodicDir
(
path
):
...
...
@@ -63,7 +67,8 @@ def isMelodicDir(path):
a MELODIC directory, ``False`` otherwise. A melodic directory:
- Must be named ``*.ica``.
- Must contain a file called ``melodic_IC.nii.gz``.
- Must contain a file called ``melodic_IC.nii.gz`` or
``melodic_oIC.nii.gz``.
- Must contain a file called ``melodic_mix``.
- Must contain a file called ``melodic_FTmix``.
"""
...
...
@@ -78,10 +83,16 @@ def isMelodicDir(path):
if
not
any
([
dirname
.
endswith
(
suf
)
for
suf
in
sufs
]):
return
False
# Must contain an image file called melodic_IC
try
:
fslimage
.
addExt
(
op
.
join
(
dirname
,
'
melodic_IC
'
),
mustExist
=
True
)
except
fslimage
.
PathError
:
# Must contain an image file called
# melodic_IC or melodic_oIC
prefixes
=
[
'
melodic_IC
'
,
'
melodic_oIC
'
]
for
p
in
prefixes
:
try
:
fslimage
.
addExt
(
op
.
join
(
dirname
,
p
))
break
except
fslimage
.
PathError
:
pass
else
:
return
False
# Must contain files called
...
...
@@ -128,7 +139,7 @@ def getDataFile(meldir):
dataFile
=
op
.
join
(
topDir
,
'
filtered_func_data
'
)
try
:
return
fslimage
.
addExt
(
dataFile
,
mustExist
=
True
)
try
:
return
fslimage
.
addExt
(
dataFile
)
except
fslimage
.
PathError
:
return
None
...
...
@@ -139,7 +150,10 @@ def getMeanFile(meldir):
def
getICFile
(
meldir
):
"""
Returns the path to the melodic IC image.
"""
return
fslimage
.
addExt
(
op
.
join
(
meldir
,
'
melodic_IC
'
))
try
:
return
fslimage
.
addExt
(
op
.
join
(
meldir
,
'
melodic_IC
'
))
except
fslimage
.
PathError
:
return
fslimage
.
addExt
(
op
.
join
(
meldir
,
'
melodic_oIC
'
))
def
getMixFile
(
meldir
):
...
...
This diff is collapsed.
Click to expand it.
fsl/data/melodicimage.py
+
1
−
1
View file @
4fb33a00
...
...
@@ -55,7 +55,7 @@ class MelodicImage(fslimage.Image):
"""
if
op
.
isdir
(
path
):
path
=
op
.
join
(
path
,
'
melodic_IC
'
)
path
=
melanalysis
.
getICFile
(
path
)
if
not
melanalysis
.
isMelodicImage
(
path
):
raise
ValueError
(
'
{} does not appear to be a
'
...
...
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