Skip to content

Commit 13d7229

Browse files
committed
conform to PEP8, add deprecated field for ROIStats interface
1 parent 426def1 commit 13d7229

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,8 @@ class ROIStatsInputSpec(CommandLineInputSpec):
18071807
position=-2,
18081808
mandatory=True,
18091809
exists=True)
1810+
mask = File(desc='input mask', argstr='-mask %s', position=3, exists=True,
1811+
deprecated='1.1.5', new_name='mask_file')
18101812
mask_file = File(desc='input mask', argstr='-mask %s', exists=True)
18111813
mask_f2short = traits.Bool(
18121814
desc='Tells the program to convert a float mask to short integers, '
@@ -1925,24 +1927,22 @@ class ROIStats(AFNICommandBase):
19251927
output_spec = ROIStatsOutputSpec
19261928

19271929
def _format_arg(self, name, spec, value):
1928-
1929-
_stat_dict = {
1930-
'mean': '-nzmean',
1931-
'median': '-nzmedian',
1932-
'mode': '-nzmode',
1933-
'minmax': '-nzminmax',
1934-
'sigma': '-nzsigma',
1935-
'voxels': '-nzvoxels',
1936-
'sum': '-nzsum',
1937-
'summary': '-summary',
1938-
'zerominmax': '-minmax',
1939-
'zeromedian': '-median',
1940-
'zerosigma': '-sigma',
1941-
'zeromode': '-mode'
1942-
}
1930+
_stat_dict = {
1931+
'mean': '-nzmean',
1932+
'median': '-nzmedian',
1933+
'mode': '-nzmode',
1934+
'minmax': '-nzminmax',
1935+
'sigma': '-nzsigma',
1936+
'voxels': '-nzvoxels',
1937+
'sum': '-nzsum',
1938+
'summary': '-summary',
1939+
'zerominmax': '-minmax',
1940+
'zeromedian': '-median',
1941+
'zerosigma': '-sigma',
1942+
'zeromode': '-mode'
1943+
}
19431944
if name == 'stat':
19441945
value = [_stat_dict[v] for v in value]
1945-
19461946
return super(ROIStats, self)._format_arg(name, spec, value)
19471947

19481948

nipype/interfaces/afni/tests/test_auto_ROIStats.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ def test_ROIStats_inputs():
2424
mandatory=True,
2525
position=-2,
2626
),
27+
mask=dict(
28+
argstr='-mask %s',
29+
deprecated='1.1.5',
30+
new_name='mask_file',
31+
position=3,
32+
),
2733
mask_f2short=dict(argstr='-mask_f2short', ),
2834
mask_file=dict(argstr='-mask %s', ),
2935
nobriklab=dict(argstr='-nobriklab', ),

nipype/interfaces/afni/tests/test_auto_ReHo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_ReHo_inputs():
2121
position=1,
2222
),
2323
label_set=dict(argstr='-in_rois %s', ),
24-
mask=dict(argstr='-mask %s', ),
24+
mask_file=dict(argstr='-mask %s', ),
2525
neighborhood=dict(
2626
argstr='-nneigh %s',
2727
xor=['sphere', 'ellipsoid'],

nipype/interfaces/afni/utils.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,8 +2318,10 @@ class ReHoInputSpec(CommandLineInputSpec):
23182318
chi_sq = traits.Bool(
23192319
argstr='-chi_sq',
23202320
desc='Output the Friedman chi-squared value in addition to the '
2321-
'Kendall\'s W.')
2322-
mask = traits.File(
2321+
'Kendall\'s W. This option is currently compatible only with '
2322+
'the AFNI (BRIK/HEAD) output type; the chi-squared value will '
2323+
'be the second sub-brick of the output dataset.')
2324+
mask_file = traits.File(
23232325
desc='Mask within which ReHo should be calculated voxelwise',
23242326
argstr='-mask %s')
23252327
neighborhood = traits.Enum(
@@ -2403,24 +2405,19 @@ class ReHo(AFNICommandBase):
24032405
output_spec = ReHoOutputSpec
24042406

24052407
def _list_outputs(self):
2406-
24072408
outputs = super(ReHo, self)._list_outputs()
2408-
24092409
if self.inputs.label_set:
24102410
outputs['out_vals'] = outputs['out_file'] + '_ROI_reho.vals'
2411-
24122411
return outputs
24132412

24142413
def _format_arg(self, name, spec, value):
2415-
2416-
_neigh_dict = {
2417-
'faces': 7,
2418-
'edges': 19,
2419-
'vertices': 27,
2420-
}
2414+
_neigh_dict = {
2415+
'faces': 7,
2416+
'edges': 19,
2417+
'vertices': 27,
2418+
}
24212419
if name == 'neighborhood':
24222420
value = _neigh_dict[value]
2423-
24242421
return super(ReHo, self)._format_arg(name, spec, value)
24252422

24262423

0 commit comments

Comments
 (0)