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
506e534a
Commit
506e534a
authored
Aug 03, 2021
by
Christoph Arthofer
Browse files
ENH: Added wrapper for epi_reg
parent
ef9ce000
Changes
3
Hide whitespace changes
Inline
Side-by-side
fsl/wrappers/__init__.py
100644 → 100755
View file @
506e534a
...
...
@@ -110,4 +110,5 @@ from .misc import (fslreorient2std, # noqa
slicer
,
cluster
,
gps
)
from
.epi_reg
import
epi_reg
from
.
import
tbss
# noqa
fsl/wrappers/epi_reg.py
0 → 100755
View file @
506e534a
#!/usr/bin/env python
#
# epi_reg.py - Wrapper for the epi_reg command.
#
# Author:
#
"""This module provides the :func:`epi_reg` function, a wrapper for the FSL
`epi_reg <https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FLIRT/UserGuide#epi_reg>`_ command.
"""
import
fsl.utils.assertions
as
asrt
from
.
import
wrapperutils
as
wutils
@
wutils
.
fileOrImage
(
'epi'
,
't1'
,
't1brain'
,
'fmap'
,
'fmapmag'
,
'fmapmagbrain'
,
'gdc'
,
'wmseg'
,
'weight'
,
outprefix
=
'out'
)
@
wutils
.
fslwrapper
def
epi_reg
(
epi
,
t1
,
t1brain
,
out
=
'epi_reg'
,
**
kwargs
):
"""Wrapper for the ``epi_reg`` command.
:arg epi: Input EPI image
:arg t1: Input wholehead T1 image
:arg t1brain: Input brain extracted T1 image
:arg out: Output name
"""
asrt
.
assertIsNifti
(
epi
)
asrt
.
assertIsNifti
(
t1
)
asrt
.
assertIsNifti
(
t1brain
)
valmap
=
{
'nofmapreg'
:
wutils
.
SHOW_IF_TRUE
,
'noclean'
:
wutils
.
SHOW_IF_TRUE
,
'v'
:
wutils
.
SHOW_IF_TRUE
,
}
cmd
=
[
'epi_reg'
,
'--epi='
+
epi
,
'--t1='
+
t1
,
'--t1brain='
+
t1brain
,
'--out='
+
out
]
cmd
+=
wutils
.
applyArgStyle
(
'--='
,
valmap
=
valmap
,
singlechar_args
=
True
,
**
kwargs
)
return
cmd
tests/test_wrappers/test_wrappers.py
100644 → 100755
View file @
506e534a
...
...
@@ -93,6 +93,14 @@ def test_flirt():
assert
checkResult
(
result
.
stdout
[
0
],
*
expected
)
def
test_epi_reg
():
with
asrt
.
disabled
(),
run
.
dryrun
(),
mockFSLDIR
(
bin
=
(
'epi_reg'
,))
as
fsldir
:
epi_reg
=
op
.
join
(
fsldir
,
'bin'
,
'epi_reg'
)
result
=
fw
.
epi_reg
(
'epi'
,
't1'
,
't1brain'
,
'out'
)
expected
=
epi_reg
+
' --epi=epi --t1=t1 --t1brain=t1brain --out=out'
assert
result
.
stdout
[
0
]
==
expected
def
test_applyxfm
():
with
asrt
.
disabled
(),
run
.
dryrun
(),
mockFSLDIR
(
bin
=
(
'flirt'
,))
as
fsldir
:
flirt
=
op
.
join
(
fsldir
,
'bin'
,
'flirt'
)
...
...
Write
Preview
Markdown
is supported
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