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

Merge branch 'master' into 'master'

ENH: Added wrapper for epi_reg

See merge request fsl/fslpy!306
parents ef9ce000 506e534a
No related branches found
No related tags found
No related merge requests found
Pipeline #10016 canceled
......@@ -110,4 +110,5 @@ from .misc import (fslreorient2std, # noqa
slicer,
cluster,
gps)
from .epi_reg import epi_reg
from . import tbss # noqa
#!/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
......@@ -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')
......
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