Skip to content

Commit aec6941

Browse files
committed
address comments
1 parent e4a94ca commit aec6941

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

nipype/interfaces/afni/tests/test_auto_LocalBistat.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
def test_LocalBistat_inputs():
77
input_map = dict(
88
args=dict(argstr='%s', ),
9-
automask=dict(),
9+
automask=dict(
10+
argstr='-automask',
11+
xor=['weight_file'],
12+
),
1013
environ=dict(
1114
nohash=True,
1215
usedefault=True,
@@ -21,12 +24,9 @@ def test_LocalBistat_inputs():
2124
mandatory=True,
2225
position=-1,
2326
),
24-
mask_file=dict(
25-
argstr='-weight %s',
26-
xor=['automask'],
27-
),
27+
mask_file=dict(argstr='-mask %s', ),
2828
neighborhood=dict(
29-
argstr='-nbhd %s',
29+
argstr="-nbhd '%s(%s)'",
3030
mandatory=True,
3131
),
3232
num_threads=dict(
@@ -42,13 +42,17 @@ def test_LocalBistat_inputs():
4242
),
4343
outputtype=dict(),
4444
stat=dict(
45-
argstr='-stat %s',
45+
argstr='-stat %s...',
4646
mandatory=True,
4747
),
4848
terminal_output=dict(
4949
deprecated='1.0.0',
5050
nohash=True,
5151
),
52+
weight_file=dict(
53+
argstr='-weight %s',
54+
xor=['automask'],
55+
),
5256
)
5357
inputs = LocalBistat.input_spec()
5458

nipype/interfaces/afni/utils.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,12 +1358,12 @@ class LocalBistatInputSpec(AFNICommandInputSpec):
13581358
'\'SPHERE\', \'RHDD\' (rhombic dodecahedron), \'TOHD\' '
13591359
'(truncated octahedron) with a given radius in mm or '
13601360
'\'RECT\' (rectangular block) with dimensions to specify in mm.',
1361-
argstr='-nbhd %s')
1361+
argstr="-nbhd '%s(%s)'")
13621362
_stat_names = ['pearson', 'spearman', 'quadrant', 'mutinfo', 'normuti',
13631363
'jointent', 'hellinger', 'crU', 'crM', 'crA', 'L2slope',
13641364
'L1slope', 'num', 'ALL']
1365-
stat = traits.Either(
1366-
traits.Enum(*_stat_names), traits.List(traits.Enum(_stat_names)),
1365+
stat = InputMultiPath(
1366+
traits.Enum(_stat_names),
13671367
mandatory=True,
13681368
desc='statistics to compute. Possible names are :'
13691369
' * pearson = Pearson correlation coefficient'
@@ -1389,16 +1389,18 @@ class LocalBistatInputSpec(AFNICommandInputSpec):
13891389
' map that size.'
13901390
' * ALL = all of the above, in that order'
13911391
'More than one option can be used.',
1392-
argstr='-stat %s')
1392+
argstr='-stat %s...')
13931393
mask_file = traits.File(
13941394
exists=True,
13951395
desc='mask image file name. Voxels NOT in the mask will not be used '
13961396
'in the neighborhood of any voxel. Also, a voxel NOT in the mask '
13971397
'will have its statistic(s) computed as zero (0).',
13981398
argstr='-mask %s')
13991399
automask = traits.Bool(
1400-
desc='Compute the mask as in program 3dAutomask.')
1401-
mask_file = traits.File(
1400+
desc='Compute the mask as in program 3dAutomask.',
1401+
argstr='-automask',
1402+
xor=['weight_file'])
1403+
weight_file = traits.File(
14021404
exists=True,
14031405
desc='File name of an image to use as a weight. Only applies to '
14041406
'\'pearson\' statistics.',
@@ -1440,19 +1442,9 @@ class LocalBistat(AFNICommand):
14401442
output_spec = AFNICommandOutputSpec
14411443

14421444
def _format_arg(self, name, spec, value):
1443-
if name == 'neighborhood':
1444-
region_name, region_size = value
1445-
if region_name == 'RECT':
1446-
return spec.argstr % (
1447-
"'{0}({1})'".format(region_name, ','.join(region_size)))
1448-
else:
1449-
return spec.argstr % (
1450-
"'{0}({1})'".format(region_name, region_size))
1451-
if name == 'stat':
1452-
if isinstance(value, (str, bytes)):
1453-
return spec.argstr % value
1454-
else:
1455-
return ' '.join([spec.argstr % v for v in value])
1445+
if name == 'neighborhood' and value[0] == 'RECT':
1446+
value = ('RECT', '%s,%s,%s' % value[1])
1447+
14561448
return super(LocalBistat, self)._format_arg(name, spec, value)
14571449

14581450

0 commit comments

Comments
 (0)