Skip to content
Snippets Groups Projects
Commit 3cfb4211 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Merge branch 'gps_wrapper' into 'master'

ENH: add wrapper for gps

See merge request fsl/fslpy!249
parents 67e0190a c24578f7
No related branches found
No related tags found
No related merge requests found
Pipeline #5582 passed
...@@ -107,4 +107,5 @@ from .melodic import (melodic, # noqa ...@@ -107,4 +107,5 @@ from .melodic import (melodic, # noqa
from .misc import (fslreorient2std, # noqa from .misc import (fslreorient2std, # noqa
fslroi, fslroi,
slicer, slicer,
cluster) cluster,
gps)
...@@ -85,3 +85,22 @@ def cluster(input, thresh, **kwargs): ...@@ -85,3 +85,22 @@ def cluster(input, thresh, **kwargs):
cmd += wutils.applyArgStyle('--=', valmap=valmap, **kwargs) cmd += wutils.applyArgStyle('--=', valmap=valmap, **kwargs)
return cmd 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
...@@ -336,7 +336,6 @@ def test_fast(): ...@@ -336,7 +336,6 @@ def test_fast():
assert result.stdout[0] == ' '.join(expected) assert result.stdout[0] == ' '.join(expected)
def test_fsl_anat(): def test_fsl_anat():
with asrt.disabled(), \ with asrt.disabled(), \
run.dryrun(), \ run.dryrun(), \
...@@ -349,3 +348,12 @@ def test_fsl_anat(): ...@@ -349,3 +348,12 @@ def test_fsl_anat():
'-s', '25'] '-s', '25']
assert result.stdout[0] == ' '.join(expected) 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment