Skip to content

Commit c6c7ba6

Browse files
committed
Merge branch 'enh/3dTCorr1D'
Conflicts: CHANGES
2 parents aea57fe + 4a7473e commit c6c7ba6

File tree

4 files changed

+126
-2
lines changed

4 files changed

+126
-2
lines changed

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Next release
33

44
* ENH: SelectFiles: a streamlined version of DataGrabber
55
* ENH: New interfaces: spm.ResliceToReference, FuzzyOverlap, afni.AFNItoNIFTI
6-
spm.DicomImport, P2PDistance
6+
afni.TCorr1D, spm.DicomImport, P2PDistance
77
* ENH: W3C PROV support with optional RDF export built into Nipype
88
* ENH: Added support for Simple Linux Utility Resource Management (SLURM)
99
* ENH: AFNI interfaces refactor, prefix, suffix are replaced by "flexible_%s_templates"

nipype/interfaces/afni/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
ZCutUp, Calc, TShift, Warp, Detrend, Despike, Copy,
1212
Fourier, Allineate, Maskave, SkullStrip, TCat, Fim,
1313
BlurInMask, Autobox, TCorrMap, Bandpass, Retroicor,
14-
TCorrelate, BrickStat, ROIStats, AutoTcorrelate,
14+
TCorrelate, TCorr1D, BrickStat, ROIStats, AutoTcorrelate,
1515
AFNItoNIFTI)

nipype/interfaces/afni/preprocess.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,70 @@ class TCorrelate(AFNICommand):
13081308
output_spec = AFNICommandOutputSpec
13091309

13101310

1311+
class TCorr1DInputSpec(AFNICommandInputSpec):
1312+
xset = File(desc = '3d+time dataset input',
1313+
argstr = ' %s',
1314+
position = -2,
1315+
mandatory = True,
1316+
exists = True)
1317+
y_1d = File(desc = '1D time series file input',
1318+
argstr = ' %s',
1319+
position = -1,
1320+
mandatory = True,
1321+
exists = True)
1322+
out_file = File(desc = 'output filename prefix',
1323+
name_template='%s_correlation.nii.gz',
1324+
argstr = '-prefix %s',
1325+
name_source = 'xset',
1326+
keep_extension = True)
1327+
pearson = traits.Bool(desc='Correlation is the normal' +
1328+
' Pearson correlation coefficient',
1329+
argstr=' -pearson',
1330+
xor=['spearman','quadrant','ktaub'],
1331+
position=1)
1332+
spearman = traits.Bool(desc='Correlation is the' +
1333+
' Spearman (rank) correlation coefficient',
1334+
argstr=' -spearman',
1335+
xor=['pearson','quadrant','ktaub'],
1336+
position=1)
1337+
quadrant = traits.Bool(desc='Correlation is the' +
1338+
' quadrant correlation coefficient',
1339+
argstr=' -quadrant',
1340+
xor=['pearson','spearman','ktaub'],
1341+
position=1)
1342+
ktaub = traits.Bool(desc='Correlation is the' +
1343+
' Kendall\'s tau_b correlation coefficient',
1344+
argstr=' -ktaub',
1345+
xor=['pearson','spearman','quadrant'],
1346+
position=1)
1347+
1348+
1349+
1350+
class TCorr1DOutputSpec(TraitedSpec):
1351+
out_file = File(desc = 'output file containing correlations',
1352+
exists = True)
1353+
1354+
1355+
class TCorr1D(AFNICommand):
1356+
"""Computes the correlation coefficient between each voxel time series
1357+
in the input 3D+time dataset.
1358+
For complete details, see the `3dTcorr1D Documentation.
1359+
<http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dTcorr1D.html>`_
1360+
1361+
>>> from nipype.interfaces import afni as afni
1362+
>>> tcorr1D = afni.TCorr1D()
1363+
>>> tcorr1D.inputs.xset= 'u_rc1s1_Template.nii'
1364+
>>> tcorr1D.inputs.y_1d = 'seed.1D'
1365+
>>> tcorr1D.cmdline
1366+
'3dTcorr1D -prefix u_rc1s1_Template_correlation.nii.gz u_rc1s1_Template.nii seed.1D'
1367+
>>> res = tcorr1D.run() # doctest: +SKIP
1368+
"""
1369+
1370+
_cmd = '3dTcorr1D'
1371+
input_spec = TCorr1DInputSpec
1372+
output_spec = TCorr1DOutputSpec
1373+
1374+
13111375
class BrickStatInputSpec(AFNICommandInputSpec):
13121376
in_file = File(desc='input file to 3dmaskave',
13131377
argstr='%s',
@@ -1861,3 +1925,4 @@ def _overload_extension(self, value):
18611925
def _gen_filename(self, name):
18621926
return os.path.abspath(super(AFNItoNIFTI, self)._gen_filename(name))
18631927

1928+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.interfaces.afni.preprocess import TCorr1D
4+
def test_TCorr1D_inputs():
5+
input_map = dict(ignore_exception=dict(nohash=True,
6+
usedefault=True,
7+
),
8+
spearman=dict(position=1,
9+
xor=['pearson', 'quadrant', 'ktaub'],
10+
argstr=' -spearman',
11+
),
12+
pearson=dict(position=1,
13+
xor=['spearman', 'quadrant', 'ktaub'],
14+
argstr=' -pearson',
15+
),
16+
out_file=dict(name_source='xset',
17+
argstr='-prefix %s',
18+
name_template='%s_correlation.nii.gz',
19+
keep_extension=True,
20+
),
21+
y_1d=dict(position=-1,
22+
mandatory=True,
23+
argstr=' %s',
24+
),
25+
ktaub=dict(position=1,
26+
xor=['pearson', 'spearman', 'quadrant'],
27+
argstr=' -ktaub',
28+
),
29+
args=dict(argstr='%s',
30+
),
31+
xset=dict(position=-2,
32+
mandatory=True,
33+
argstr=' %s',
34+
),
35+
outputtype=dict(),
36+
quadrant=dict(position=1,
37+
xor=['pearson', 'spearman', 'ktaub'],
38+
argstr=' -quadrant',
39+
),
40+
terminal_output=dict(mandatory=True,
41+
nohash=True,
42+
),
43+
environ=dict(nohash=True,
44+
usedefault=True,
45+
),
46+
)
47+
inputs = TCorr1D.input_spec()
48+
49+
for key, metadata in input_map.items():
50+
for metakey, value in metadata.items():
51+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
52+
def test_TCorr1D_outputs():
53+
output_map = dict(out_file=dict(),
54+
)
55+
outputs = TCorr1D.output_spec()
56+
57+
for key, metadata in output_map.items():
58+
for metakey, value in metadata.items():
59+
yield assert_equal, getattr(outputs.traits()[key], metakey), value

0 commit comments

Comments
 (0)