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
91bb5c27
Commit
91bb5c27
authored
Nov 30, 2021
by
Evan Edmond
Committed by
Paul McCarthy
Nov 30, 2021
Browse files
ENH: wrapper for `fslorient` tool
parent
4ef642f3
Changes
3
Show whitespace changes
Inline
Side-by-side
fsl/wrappers/__init__.py
View file @
91bb5c27
...
...
@@ -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
,
...
...
fsl/wrappers/misc.py
View file @
91bb5c27
...
...
@@ -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
):
...
...
tests/test_wrappers/test_wrappers.py
View file @
91bb5c27
...
...
@@ -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
:
...
...
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