From d181f4cc5c0bc2ddc1fa729860d63930878f8d16 Mon Sep 17 00:00:00 2001 From: salma1601 Date: Tue, 3 Oct 2017 17:19:42 +0200 Subject: [PATCH 1/2] allow float as weight --- nipype/interfaces/afni/preprocess.py | 7 ++++--- nipype/interfaces/afni/tests/test_auto_Allineate.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 97455ec69f..c890782614 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -353,12 +353,13 @@ class AllineateInputSpec(AFNICommandInputSpec): argstr='-nomask', desc='Don\'t compute the autoweight/mask; if -weight is not ' 'also used, then every voxel will be counted equally.') - weight_file = File( + weight = traits.Either( + File(exists=True), traits.Float(), argstr='-weight %s', - exists=True, desc='Set the weighting for each voxel in the base dataset; ' 'larger weights mean that voxel count more in the cost function. ' - 'Must be defined on the same grid as the base dataset') + 'If an image file is given, the volume must be defined on the ' + 'same grid as the base dataset') out_weight_file = traits.File( argstr='-wtprefix %s', desc='Write the weight volume to disk as a dataset', diff --git a/nipype/interfaces/afni/tests/test_auto_Allineate.py b/nipype/interfaces/afni/tests/test_auto_Allineate.py index d1a8ae2187..adc10179db 100644 --- a/nipype/interfaces/afni/tests/test_auto_Allineate.py +++ b/nipype/interfaces/afni/tests/test_auto_Allineate.py @@ -117,7 +117,7 @@ def test_Allineate_inputs(): ), warpfreeze=dict(argstr='-warpfreeze', ), - weight_file=dict(argstr='-weight %s', + weight=dict(argstr='-weight %s', ), zclip=dict(argstr='-zclip', ), From 40b66be8150553ef280af70b5b3b5ea2c39cfc9b Mon Sep 17 00:00:00 2001 From: salma1601 Date: Wed, 4 Oct 2017 15:56:35 +0200 Subject: [PATCH 2/2] use deprecated for weight_file --- nipype/interfaces/afni/preprocess.py | 7 +++++++ nipype/interfaces/afni/tests/test_auto_Allineate.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index c890782614..fe8a963777 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -353,6 +353,13 @@ class AllineateInputSpec(AFNICommandInputSpec): argstr='-nomask', desc='Don\'t compute the autoweight/mask; if -weight is not ' 'also used, then every voxel will be counted equally.') + weight_file = File( + argstr='-weight %s', + exists=True, + deprecated='1.0.0', new_name='weight', + desc='Set the weighting for each voxel in the base dataset; ' + 'larger weights mean that voxel count more in the cost function. ' + 'Must be defined on the same grid as the base dataset') weight = traits.Either( File(exists=True), traits.Float(), argstr='-weight %s', diff --git a/nipype/interfaces/afni/tests/test_auto_Allineate.py b/nipype/interfaces/afni/tests/test_auto_Allineate.py index adc10179db..f1e6d4181a 100644 --- a/nipype/interfaces/afni/tests/test_auto_Allineate.py +++ b/nipype/interfaces/afni/tests/test_auto_Allineate.py @@ -119,6 +119,10 @@ def test_Allineate_inputs(): ), weight=dict(argstr='-weight %s', ), + weight_file=dict(argstr='-weight %s', + deprecated='1.0.0', + new_name='weight', + ), zclip=dict(argstr='-zclip', ), )