Commit c24578f7 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

ENH: add wrapper for gps

parent 67e0190a
......@@ -107,4 +107,5 @@ from .melodic import (melodic, # noqa
from .misc import (fslreorient2std, # noqa
fslroi,
slicer,
cluster)
cluster,
gps)
......@@ -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
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment