Skip to content

Commit b543ccb

Browse files
committed
Merge pull request #654 from alexschaefer83/master
Adding Simple 3dRetroicor Interface
2 parents 518233d + 33cb2d6 commit b543ccb

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

nipype/interfaces/afni/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
ZCutUp, Calc, TShift, Warp, Detrend, Despike, Copy,
1313
Fourier, Allineate, Maskave, SkullStrip, TCat, Fim,
1414
TCorrelate, BrickStat, ROIStats, AutoTcorrelate,
15-
BlurInMask, Autobox, TCorrMap, Bandpass)
15+
BlurInMask, Autobox, TCorrMap, Bandpass, Retroicor)

nipype/interfaces/afni/preprocess.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,3 +1762,70 @@ def _gen_filename(self, name):
17621762
if name == 'out_file' and (not isdefined(self.inputs.out_file)):
17631763
return Undefined
17641764
return super(Autobox, self)._gen_filename(name)
1765+
1766+
class RetroicorInputSpec(AFNICommandInputSpec):
1767+
in_file = File(desc='input file to 3dretroicor',
1768+
argstr='%s',
1769+
position=-1,
1770+
mandatory=True,
1771+
exists=True)
1772+
out_file = File(desc='output image file name', argstr='-prefix %s', mandatory=True, position=1)
1773+
card = File(desc='1D cardiac data file for cardiac correction',
1774+
argstr='-card %s',
1775+
position=-2,
1776+
exists=True)
1777+
resp = File(desc='1D respiratory waveform data for correction',
1778+
argstr='-resp %s',
1779+
position=-3,
1780+
exists=True)
1781+
threshold = traits.Int(desc='Threshold for detection of R-wave peaks in input (Make sure it is above the background noise level, Try 3/4 or 4/5 times range plus minimum)',
1782+
argstr='-threshold %d',
1783+
position=-4)
1784+
order = traits.Int(desc='The order of the correction (2 is typical)',
1785+
argstr='-order %s',
1786+
position=-5)
1787+
1788+
cardphase = File(desc='Filename for 1D cardiac phase output',
1789+
argstr='-cardphase %s',
1790+
position=-6,
1791+
hash_files=False)
1792+
respphase = File(desc='Filename for 1D resp phase output',
1793+
argstr='-respphase %s',
1794+
position=-7,
1795+
hash_files=False)
1796+
1797+
1798+
class Retroicor(AFNICommand):
1799+
"""Performs Retrospective Image Correction for physiological
1800+
motion effects, using a slightly modified version of the
1801+
RETROICOR algorithm
1802+
1803+
The durations of the physiological inputs are assumed to equal
1804+
the duration of the dataset. Any constant sampling rate may be
1805+
used, but 40 Hz seems to be acceptable. This program's cardiac
1806+
peak detection algorithm is rather simplistic, so you might try
1807+
using the scanner's cardiac gating output (transform it to a
1808+
spike wave if necessary).
1809+
1810+
This program uses slice timing information embedded in the
1811+
dataset to estimate the proper cardiac/respiratory phase for
1812+
each slice. It makes sense to run this program before any
1813+
program that may destroy the slice timings (e.g. 3dvolreg for
1814+
motion correction).
1815+
1816+
For complete details, see the `3dretroicor Documentation.
1817+
<http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dretroicor.html>`_
1818+
1819+
Examples
1820+
========
1821+
>>> from nipype.interfaces import afni as afni
1822+
>>> ret = afni.Retroicor()
1823+
>>> ret.inputs.in_file = 'functional.nii'
1824+
>>> ret.inputs.card = 'mask.1D'
1825+
>>> ret.inputs.resp = 'resp.1D'
1826+
>>> res = ret.run() # doctest: +SKIP
1827+
"""
1828+
1829+
_cmd = '3dretroicor'
1830+
input_spec = RetroicorInputSpec
1831+
output_spec = AFNICommandOutputSpec

nipype/testing/data/mask.1D

Whitespace-only changes.

nipype/testing/data/resp.1D

Whitespace-only changes.

0 commit comments

Comments
 (0)