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
c24578f7
Commit
c24578f7
authored
4 years ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add wrapper for gps
parent
67e0190a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fsl/wrappers/__init__.py
+2
-1
2 additions, 1 deletion
fsl/wrappers/__init__.py
fsl/wrappers/misc.py
+19
-0
19 additions, 0 deletions
fsl/wrappers/misc.py
tests/test_wrappers/test_wrappers.py
+9
-1
9 additions, 1 deletion
tests/test_wrappers/test_wrappers.py
with
30 additions
and
2 deletions
fsl/wrappers/__init__.py
+
2
−
1
View file @
c24578f7
...
...
@@ -107,4 +107,5 @@ from .melodic import (melodic, # noqa
from
.misc
import
(
fslreorient2std
,
# noqa
fslroi
,
slicer
,
cluster
)
cluster
,
gps
)
This diff is collapsed.
Click to expand it.
fsl/wrappers/misc.py
+
19
−
0
View file @
c24578f7
...
...
@@ -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
This diff is collapsed.
Click to expand it.
tests/test_wrappers/test_wrappers.py
+
9
−
1
View file @
c24578f7
...
...
@@ -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
)
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