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
3cfb4211
Commit
3cfb4211
authored
Jul 23, 2020
by
Paul McCarthy
🚵
Browse files
Merge branch 'gps_wrapper' into 'master'
ENH: add wrapper for gps See merge request fsl/fslpy!249
parents
67e0190a
c24578f7
Pipeline
#5582
passed with stages
in 14 minutes and 42 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fsl/wrappers/__init__.py
View file @
3cfb4211
...
...
@@ -107,4 +107,5 @@ from .melodic import (melodic, # noqa
from
.misc
import
(
fslreorient2std
,
# noqa
fslroi
,
slicer
,
cluster
)
cluster
,
gps
)
fsl/wrappers/misc.py
View file @
3cfb4211
...
...
@@ -85,3 +85,22 @@ def cluster(input, thresh, **kwargs):
cmd
+=
wutils
.
applyArgStyle
(
'--='
,
valmap
=
valmap
,
**
kwargs
)
return
cmd
@
wutils
.
fileOrArray
(
'out'
,
'init'
)
@
wutils
.
fslwrapper
def
gps
(
out
,
ndir
,
**
kwargs
):
"""Wrapper of the ``gps`` command
Usage example to get 128 gradient orientations on the whole sphere::
from fsl.wrappers import gps, LOAD
bvecs = gps(LOAD, 128, optws=True)['out']
"""
valmap
=
{
name
:
wutils
.
SHOW_IF_TRUE
for
name
in
[
'optws'
,
'report'
,
'verbose'
]}
cmd
=
[
'gps'
,
f
'--ndir=
{
ndir
}
'
,
f
'--out=
{
out
}
'
]
cmd
+=
wutils
.
applyArgStyle
(
'--='
,
valmap
=
valmap
,
**
kwargs
)
return
cmd
tests/test_wrappers/test_wrappers.py
View file @
3cfb4211
...
...
@@ -336,7 +336,6 @@ def test_fast():
assert
result
.
stdout
[
0
]
==
' '
.
join
(
expected
)
def
test_fsl_anat
():
with
asrt
.
disabled
(),
\
run
.
dryrun
(),
\
...
...
@@ -349,3 +348,12 @@ def test_fsl_anat():
'-s'
,
'25'
]
assert
result
.
stdout
[
0
]
==
' '
.
join
(
expected
)
def
test_gps
():
with
asrt
.
disabled
(),
run
.
dryrun
(),
mockFSLDIR
(
bin
=
(
'gps'
,))
as
fsldir
:
gps
=
op
.
join
(
fsldir
,
'bin'
,
'gps'
)
result
=
fw
.
gps
(
'bvecs'
,
128
,
optws
=
True
,
ranseed
=
123
)
expected
=
(
gps
+
' --ndir=128 --out=bvecs'
,
(
'--optws'
,
'--ranseed=123'
))
assert
checkResult
(
result
.
stdout
[
0
],
*
expected
)
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