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
51abe031
Commit
51abe031
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Clean up melodic module. Add alternate for flirt 2D option
parent
82083da2
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/wrappers/flirt.py
+10
-2
10 additions, 2 deletions
fsl/wrappers/flirt.py
fsl/wrappers/melodic.py
+61
-36
61 additions, 36 deletions
fsl/wrappers/melodic.py
with
71 additions
and
38 deletions
fsl/wrappers/flirt.py
+
10
−
2
View file @
51abe031
...
...
@@ -29,10 +29,18 @@ from . import wrapperutils as wutils
@wutils.fileOrImage
(
'
src
'
,
'
ref
'
,
'
out
'
,
'
wmseg
'
,
'
fieldmap
'
,
'
fieldmapmask
'
)
@wutils.fileOrArray
(
'
init
'
,
'
omat
'
,
'
wmcoords
'
,
'
wmnorms
'
)
def
flirt
(
src
,
ref
,
**
kwargs
):
"""
Wrapper for the ``flirt`` command.
"""
"""
Wrapper for the ``flirt`` command.
The ``twod`` argument may be used in place of the ``2D`` command line
option.
"""
asrt
.
assertIsNifti
(
src
,
ref
)
argmap
=
{
'
twod
'
:
'
2D
'
}
valmap
=
{
'
usesqform
'
:
wutils
.
SHOW_IF_TRUE
,
'
displayinit
'
:
wutils
.
SHOW_IF_TRUE
,
...
...
@@ -47,7 +55,7 @@ def flirt(src, ref, **kwargs):
}
cmd
=
[
'
flirt
'
,
'
-in
'
,
src
,
'
-ref
'
,
ref
]
cmd
+=
wutils
.
applyArgStyle
(
'
-
'
,
valmap
=
valmap
,
**
kwargs
)
cmd
+=
wutils
.
applyArgStyle
(
'
-
'
,
argmap
=
argmap
,
valmap
=
valmap
,
**
kwargs
)
return
run
.
runfsl
(
cmd
)
...
...
This diff is collapsed.
Click to expand it.
fsl/wrappers/melodic.py
+
61
−
36
View file @
51abe031
#!/usr/bin/env python
#
# melodic.py -
# melodic.py -
Wrappers for melodic.
#
# Author: Sean Fitzgibbon <sean.fitzgibbon@ndcn.ox.ac.uk>
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
"""
This module provides wrapper functions for the FSL `MELODIC
<https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/MELODIC>`_ tool, and other
related utilities.
.. autosummary::
:nosignatures:
melodic
fsl_regfilt
"""
import
fsl.utils.run
as
run
import
fsl.utils.assertions
as
asrt
from
.
import
wrapperutils
as
wutils
def
melodic
(
input
,
outdir
,
dim
=
None
,
tr
=
N
on
e
,
mmthresh
=
None
,
report
=
True
,
prefix
=
None
,
nomask
=
False
,
updatemask
=
False
,
nobet
=
False
,
mask
=
None
):
@wutils.fileOrArray
(
'
mix
'
,
'
Tdes
'
,
'
Tc
on
'
,
'
Sdes
'
,
'
Scon
'
)
@wutils.fileOrImage
(
'
input
'
,
'
mask
'
,
'
ICs
'
,
'
bgimage
'
)
def
melodic
(
input
,
**
kwargs
):
"""
Multivariate Exploratory Linear Optimised ICA.
"""
valmap
=
{
'
Oall
'
:
wutils
.
SHOW_IF_TRUE
,
'
Ounmix
'
:
wutils
.
SHOW_IF_TRUE
,
'
Ostats
'
:
wutils
.
SHOW_IF_TRUE
,
'
Opca
'
:
wutils
.
SHOW_IF_TRUE
,
'
Owhite
'
:
wutils
.
SHOW_IF_TRUE
,
'
Oorig
'
:
wutils
.
SHOW_IF_TRUE
,
'
Omean
'
:
wutils
.
SHOW_IF_TRUE
,
'
verbose
'
:
wutils
.
SHOW_IF_TRUE
,
'
debug
'
:
wutils
.
SHOW_IF_TRUE
,
'
report
'
:
wutils
.
SHOW_IF_TRUE
,
'
CIFTI
'
:
wutils
.
SHOW_IF_TRUE
,
'
varnorm
'
:
wutils
.
SHOW_IF_TRUE
,
'
nomask
'
:
wutils
.
SHOW_IF_TRUE
,
'
nobet
'
:
wutils
.
SHOW_IF_TRUE
,
'
sep_vn
'
:
wutils
.
SHOW_IF_TRUE
,
'
disableMigp
'
:
wutils
.
SHOW_IF_TRUE
,
'
update_mask
'
:
wutils
.
HIDE_IF_TRUE
,
'
migp_shuffle
'
:
wutils
.
HIDE_IF_TRUE
,
'
no_mm
'
:
wutils
.
SHOW_IF_TRUE
,
'
logPower
'
:
wutils
.
SHOW_IF_TRUE
,
}
asrt
.
assertIsNifti
(
input
)
cmd
=
"
melodic -i {0} -v --Oall --outdir={1}
"
.
format
(
input
,
outdir
)
if
mmthresh
:
cmd
+=
"
--mmthresh={0}
"
.
format
(
mmthresh
)
if
dim
:
cmd
+=
"
-d -{0}
"
.
format
(
dim
)
if
report
:
cmd
+=
"
--report
"
if
tr
:
cmd
+=
"
--tr={0}
"
.
format
(
tr
)
if
nomask
:
cmd
+=
"
--nomask
"
if
updatemask
:
cmd
+=
"
--update_mask
"
if
nobet
:
cmd
+=
"
--nobet
"
if
prefix
:
cmd
=
prefix
+
"
"
+
cmd
if
mask
is
not
None
:
cmd
+=
"
--mask={0}
"
.
format
(
mask
)
cmd
=
[
'
melodic
'
,
'
--in
'
,
input
]
cmd
+=
wutils
.
applyArgStyle
(
'
--=
'
,
valmap
=
valmap
,
**
kwargs
)
return
run
.
runfsl
(
cmd
)
def
fsl_regfilt
(
infile
,
outfile
,
mix
,
ics
):
"""
Data de-noising by regression.
@wutils.fileOrImage
(
'
input
'
,
'
out
'
,
'
mask
'
,
'
out_data
'
)
@wutils.fileOrArray
(
'
design
'
,
'
out_mix
'
)
def
fsl_regfilt
(
input
,
out
,
design
,
**
kwargs
):
"""
Wrapper for the ``fsl_regfilt``command.
"""
asrt
.
assertIsNifti
(
input
,
out
)
Data de-noising by regressing out part of a design matrix
using simple OLS regression on 4D images
"""
asrt
.
assertIsNifti
(
infile
,
outfile
)
valmap
=
{
'
freqfilt
'
:
wutils
.
SHOW_IF_TRUE
,
'
freq_ic
'
:
wutils
.
HIDE_IF_TRUE
,
'
vn
'
:
wutils
.
SHOW_IF_TRUE
,
'
v
'
:
wutils
.
SHOW_IF_TRUE
,
}
icstr
=
'"'
for
i
in
range
(
0
,
len
(
ics
)
-
1
):
icstr
=
icstr
+
'
{0},
'
.
format
(
ics
[
i
]
+
1
)
icstr
=
icstr
+
'
{0}
"'
.
format
(
ics
[
-
1
]
+
1
)
cmd
=
[
'
fsl_regfilt
'
,
'
--in={}
'
.
format
(
input
),
'
--out={}
'
.
format
(
out
),
'
--design={}
'
.
format
(
design
)]
cmd
+=
wutils
.
applyArgStyle
(
'
--=
'
,
valmap
=
valmap
,
**
kwargs
)
cmd
=
"
fsl_regfilt -i {0} -o {1} -d {2} -f {3}
"
.
format
(
infile
,
outfile
,
mix
,
icstr
)
return
run
.
runfsl
(
cmd
)
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