Skip to content

Commit 007d2d7

Browse files
committed
All tests pass
1 parent 0ac706f commit 007d2d7

File tree

3 files changed

+20
-30
lines changed

3 files changed

+20
-30
lines changed

nipype/interfaces/afni/base.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
warn = warnings.warn
1414
warnings.filterwarnings('always', category=UserWarning)
1515

16-
###################################
17-
#
18-
# NEW_AFNI base class
19-
#
20-
###################################
21-
2216

2317
class Info(object):
2418
"""Handle afni output type and version information.
@@ -117,7 +111,7 @@ class AFNICommand(CommandLine):
117111

118112

119113
def __init__(self, **inputs):
120-
super(CommandLine, self).__init__(**inputs)
114+
super(AFNICommand, self).__init__(**inputs)
121115
self.inputs.on_trait_change(self._output_update, 'outputtype')
122116

123117
if self._outputtype is None:
@@ -150,8 +144,6 @@ def set_default_output_type(cls, outputtype):
150144
else:
151145
raise AttributeError('Invalid AFNI outputtype: %s' % outputtype)
152146

153-
154-
155147
def _overload_extension(self, value):
156148
path, base, _ = split_filename(value)
157149
return os.path.join(path, base + Info.outputtype_to_ext(self.inputs.outputtype))

nipype/interfaces/afni/preprocess.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ class Resample(AFNICommand):
299299
>>> resample = afni.Resample()
300300
>>> resample.inputs.in_file = 'functional.nii'
301301
>>> resample.inputs.orientation= 'RPI'
302-
>>> resample.inputs.outputtype = "NIFIT"
302+
>>> resample.inputs.outputtype = "NIFTI"
303303
>>> resample.cmdline
304-
'3dAFNItoNIFTI -prefix afni_output.nii afni_output.3D'
304+
'3dresample -orient RPI -prefix functional_resample.nii -inset functional.nii'
305305
>>> res = resample.run() # doctest: +SKIP
306306
307307
"""
@@ -531,7 +531,7 @@ class Automask(AFNICommand):
531531
>>> automask.inputs.dilate = 1
532532
>>> automask.inputs.outputtype = "NIFTI"
533533
>>> automask.cmdline #doctest: +ELLIPSIS
534-
'3dAutomask -apply_prefix .../functional_masked.nii -dilate 1 -prefix .../functional_mask.nii functional.nii'
534+
'3dAutomask -apply_prefix functional_masked.nii -dilate 1 -prefix functional_mask.nii functional.nii'
535535
>>> res = automask.run() # doctest: +SKIP
536536
537537
"""
@@ -548,8 +548,8 @@ class VolregInputSpec(AFNICommandInputSpec):
548548
position=-1,
549549
mandatory=True,
550550
exists=True)
551-
out_file = File("%s_volreg", desc='output image file name',
552-
argstr='-prefix %s', name_source="in_file", usedefault=True)
551+
out_file = File(name_template="%s_volreg", desc='output image file name',
552+
argstr='-prefix %s', name_source="in_file")
553553

554554
basefile = File(desc='base file for registration',
555555
argstr='-base %s',
@@ -597,7 +597,7 @@ class Volreg(AFNICommand):
597597
>>> volreg.inputs.zpad = 4
598598
>>> volreg.inputs.outputtype = "NIFTI"
599599
>>> volreg.cmdline #doctest: +ELLIPSIS
600-
'3dvolreg -Fourier -twopass -1Dfile .../functional.1D -prefix .../functional_volreg.nii -zpad 4 functional.nii'
600+
'3dvolreg -Fourier -twopass -1Dfile functional.1D -prefix functional_volreg.nii -zpad 4 functional.nii'
601601
>>> res = volreg.run() # doctest: +SKIP
602602
603603
"""
@@ -1112,10 +1112,9 @@ class MaskaveInputSpec(AFNICommandInputSpec):
11121112
position=-2,
11131113
mandatory=True,
11141114
exists=True)
1115-
out_file = File("%s_maskave.1D", desc='output image file name',
1115+
out_file = File(name_template="%s_maskave.1D", desc='output image file name',
11161116
keep_extension=True,
1117-
argstr="> %s", name_source="in_file", usedefault=True,
1118-
position=-1)
1117+
argstr="> %s", name_source="in_file", position=-1)
11191118
mask = File(desc='matrix to align input file',
11201119
argstr='-mask %s',
11211120
position=1,
@@ -1141,7 +1140,7 @@ class Maskave(AFNICommand):
11411140
>>> maskave.inputs.mask= 'seed_mask.nii'
11421141
>>> maskave.inputs.quiet= True
11431142
>>> maskave.cmdline #doctest: +ELLIPSIS
1144-
'3dmaskave -mask seed_mask.nii -quiet functional.nii > .../functional_maskave.1D'
1143+
'3dmaskave -mask seed_mask.nii -quiet functional.nii > functional_maskave.1D'
11451144
>>> res = maskave.run() # doctest: +SKIP
11461145
11471146
"""
@@ -1480,8 +1479,8 @@ class CalcInputSpec(AFNICommandInputSpec):
14801479
argstr='-a %s', position=0, mandatory=True, exists=True)
14811480
in_file_b = File(desc='operand file to 3dcalc',
14821481
argstr=' -b %s', position=1, exists=True)
1483-
out_file = File("%s_calc", desc='output image file name',
1484-
argstr='-prefix %s', name_source="in_file_a", usedefault=True)
1482+
out_file = File(name_template="%s_calc", desc='output image file name',
1483+
argstr='-prefix %s', name_source="in_file_a")
14851484
expr = traits.Str(desc='expr', argstr='-expr "%s"', position=2,
14861485
mandatory=True)
14871486
start_idx = traits.Int(desc='start index for in_file_a',
@@ -1510,7 +1509,7 @@ class Calc(AFNICommand):
15101509
>>> calc.inputs.out_file = 'functional_calc.nii.gz'
15111510
>>> calc.inputs.outputtype = "NIFTI"
15121511
>>> calc.cmdline #doctest: +ELLIPSIS
1513-
'3dcalc -a functional.nii -b functional2.nii -expr "a*b" -prefix functional_calc.nii'
1512+
'3dcalc -a functional.nii -b functional2.nii -expr "a*b" -prefix functional_calc.nii.gz'
15141513
15151514
"""
15161515

@@ -1543,9 +1542,8 @@ class BlurInMaskInputSpec(AFNICommandInputSpec):
15431542
position=1,
15441543
mandatory=True,
15451544
exists=True)
1546-
out_file = File('%s_blur', desc='output to the file', argstr='-prefix %s',
1547-
name_source='in_file', position=-1, genfile=True,
1548-
usedefault=True)
1545+
out_file = File(name_template='%s_blur', desc='output to the file', argstr='-prefix %s',
1546+
name_source='in_file', position=-1)
15491547
mask = File(
15501548
desc='Mask dataset, if desired. Blurring will occur only within the mask. Voxels NOT in the mask will be set to zero in the output.',
15511549
argstr='-mask %s')
@@ -1584,7 +1582,7 @@ class BlurInMask(AFNICommand):
15841582
>>> bim.inputs.mask = 'mask.nii'
15851583
>>> bim.inputs.fwhm = 5.0
15861584
>>> bim.cmdline #doctest: +ELLIPSIS
1587-
'3dBlurInMask -input functional.nii -FWHM 5.000000 -mask mask.nii -prefix .../functional_blur+orig.BRIK'
1585+
'3dBlurInMask -input functional.nii -FWHM 5.000000 -mask mask.nii -prefix functional_blur'
15881586
>>> res = bim.run() # doctest: +SKIP
15891587
15901588
"""
@@ -1840,8 +1838,8 @@ class AFNItoNIFTIInputSpec(AFNICommandInputSpec):
18401838
position=-1,
18411839
mandatory=True,
18421840
exists=True)
1843-
out_file = File("%s.nii", desc='output image file name',
1844-
argstr='-prefix %s', name_source="in_file", usedefault=True)
1841+
out_file = File(name_template="%s.nii", desc='output image file name',
1842+
argstr='-prefix %s', name_source="in_file")
18451843
hash_files = False
18461844

18471845
class AFNItoNIFTI(AFNICommand):
@@ -1858,7 +1856,7 @@ class AFNItoNIFTI(AFNICommand):
18581856
>>> a2n.inputs.in_file = 'afni_output.3D'
18591857
>>> a2n.inputs.out_file = 'afni_output.nii'
18601858
>>> a2n.cmdline
1861-
'3dAFNItoNIFTI afni_output.3D'
1859+
'3dAFNItoNIFTI -prefix afni_output.nii afni_output.3D'
18621860
18631861
"""
18641862

nipype/interfaces/afni/tests/test_preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_to3d():
106106
filetype=dict(argstr='-%s',),
107107
funcparams=dict(argstr='-time:zt %s alt+z2',),
108108
ignore_exception=dict(usedefault=True,),
109-
infolder=dict(argstr='%s/*.dcm', mandatory=True,),
109+
in_folder=dict(argstr='%s/*.dcm', mandatory=True,),
110110
out_file=dict(argstr='-prefix %s'),
111111
outputtype=dict(),
112112
skipoutliers=dict(argstr='-skip_outliers',),

0 commit comments

Comments
 (0)