Commit 91bb5c27 authored by Evan Edmond's avatar Evan Edmond Committed by Paul McCarthy
Browse files

ENH: wrapper for `fslorient` tool

parent 4ef642f3
......@@ -110,6 +110,7 @@ from fsl.wrappers.fugue import (fugue,
from fsl.wrappers.melodic import (melodic,
fsl_regfilt)
from fsl.wrappers.misc import (fslreorient2std,
fslorient,
fslroi,
slicer,
cluster,
......
......@@ -29,6 +29,34 @@ def fslreorient2std(input, output=None):
return cmd
@wutils.fileOrImage('input')
@wutils.fslwrapper
def fslorient(input, **kwargs):
"""Wrapper for the ``fslorient`` tool."""
asrt.assertIsNifti(input)
valmap = {
'getorient' : wutils.SHOW_IF_TRUE,
'getsform' : wutils.SHOW_IF_TRUE,
'getqform' : wutils.SHOW_IF_TRUE,
'getsformcode' : wutils.SHOW_IF_TRUE,
'getqformcode' : wutils.SHOW_IF_TRUE,
'copysform2qform' : wutils.SHOW_IF_TRUE,
'copyqform2sform' : wutils.SHOW_IF_TRUE,
'deleteorient' : wutils.SHOW_IF_TRUE,
'forceradiological' : wutils.SHOW_IF_TRUE,
'forceneurological' : wutils.SHOW_IF_TRUE,
'swaporient' : wutils.SHOW_IF_TRUE,
}
cmd = ['fslorient']
cmd += wutils.applyArgStyle('-', valsep=' ', valmap=valmap, **kwargs)
cmd += [input]
return cmd
@wutils.fileOrImage('input', 'output')
@wutils.fslwrapper
def fslroi(input, output, *args):
......
......@@ -250,6 +250,21 @@ def test_fsl_regfilt():
assert checkResult(result.stdout[0], *expected)
def test_fslorient():
with asrt.disabled(), run.dryrun(), mockFSLDIR(bin=('fslorient',)) as fsldir:
fslo = op.join(fsldir, 'bin', 'fslorient')
result = fw.fslorient('input', setsform=(-2, 0, 0, 90, 0, 2, 0, -126, 0, 0, 2, -72, 0, 0, 0, 1))
expected = fslo + ' -setsform -2 0 0 90 0 2 0 -126 0 0 2 -72 0 0 0 1' + ' input'
assert result.stdout[0] == expected
result = fw.fslorient('input', getorient=True)
expected = fslo + ' -getorient' + ' input'
assert result.stdout[0] == expected
result = fw.fslorient('input', setsformcode=1)
expected = fslo + ' -setsformcode 1' + ' input'
assert result.stdout[0] == expected
def test_fslreorient2std():
with asrt.disabled(), run.dryrun(), mockFSLDIR(bin=('fslreorient2std',)) as fsldir:
......
Markdown is supported
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