From 7ef923a2ebafecda95f7a05af783cad4c05bf86b Mon Sep 17 00:00:00 2001 From: salma1601 Date: Sat, 4 Jan 2020 22:54:44 +0100 Subject: [PATCH 1/5] generate out_matrix name --- nipype/interfaces/afni/preprocess.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 1d53aac98c..ba33994684 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -283,6 +283,9 @@ class AllineateInputSpec(AFNICommandInputSpec): ) out_matrix = File( argstr="-1Dmatrix_save %s", + name_template='%s_allineated.aff12.1D', + name_source='in_file', + keep_extension=False, desc="Save the transformation matrix for each volume.", xor=["in_matrix", "allcostx"], ) From 2a1d705addc4256809b433a5f7761177ed9af64e Mon Sep 17 00:00:00 2001 From: salma1601 Date: Sat, 4 Jan 2020 22:58:38 +0100 Subject: [PATCH 2/5] update Allineate test --- .../afni/tests/test_auto_Allineate.py | 113 +++++++++--------- 1 file changed, 59 insertions(+), 54 deletions(-) diff --git a/nipype/interfaces/afni/tests/test_auto_Allineate.py b/nipype/interfaces/afni/tests/test_auto_Allineate.py index 356e7d52a0..7c4f74718c 100644 --- a/nipype/interfaces/afni/tests/test_auto_Allineate.py +++ b/nipype/interfaces/afni/tests/test_auto_Allineate.py @@ -10,20 +10,20 @@ def test_Allineate_inputs(): position=-1, xor=["out_file", "out_matrix", "out_param_file", "out_weight_file"], ), - args=dict(argstr="%s",), - autobox=dict(argstr="-autobox",), - automask=dict(argstr="-automask+%d",), - autoweight=dict(argstr="-autoweight%s",), - center_of_mass=dict(argstr="-cmass%s",), - check=dict(argstr="-check %s",), - convergence=dict(argstr="-conv %f",), - cost=dict(argstr="-cost %s",), - environ=dict(nohash=True, usedefault=True,), - epi=dict(argstr="-EPI",), - final_interpolation=dict(argstr="-final %s",), - fine_blur=dict(argstr="-fineblur %f",), + args=dict(argstr="%s"), + autobox=dict(argstr="-autobox"), + automask=dict(argstr="-automask+%d"), + autoweight=dict(argstr="-autoweight%s"), + center_of_mass=dict(argstr="-cmass%s"), + check=dict(argstr="-check %s"), + convergence=dict(argstr="-conv %f"), + cost=dict(argstr="-cost %s"), + environ=dict(nohash=True, usedefault=True), + epi=dict(argstr="-EPI"), + final_interpolation=dict(argstr="-final %s"), + fine_blur=dict(argstr="-fineblur %f"), in_file=dict( - argstr="-source %s", copyfile=False, extensions=None, mandatory=True, + argstr="-source %s", copyfile=False, extensions=None, mandatory=True ), in_matrix=dict( argstr="-1Dmatrix_apply %s", @@ -32,23 +32,23 @@ def test_Allineate_inputs(): xor=["out_matrix"], ), in_param_file=dict( - argstr="-1Dparam_apply %s", extensions=None, xor=["out_param_file"], + argstr="-1Dparam_apply %s", extensions=None, xor=["out_param_file"] ), - interpolation=dict(argstr="-interp %s",), - master=dict(argstr="-master %s", extensions=None,), - maxrot=dict(argstr="-maxrot %f",), - maxscl=dict(argstr="-maxscl %f",), - maxshf=dict(argstr="-maxshf %f",), - maxshr=dict(argstr="-maxshr %f",), - newgrid=dict(argstr="-newgrid %f",), - nmatch=dict(argstr="-nmatch %d",), - no_pad=dict(argstr="-nopad",), - nomask=dict(argstr="-nomask",), - num_threads=dict(nohash=True, usedefault=True,), - nwarp=dict(argstr="-nwarp %s",), - nwarp_fixdep=dict(argstr="-nwarp_fixdep%s...",), - nwarp_fixmot=dict(argstr="-nwarp_fixmot%s...",), - one_pass=dict(argstr="-onepass",), + interpolation=dict(argstr="-interp %s"), + master=dict(argstr="-master %s", extensions=None), + maxrot=dict(argstr="-maxrot %f"), + maxscl=dict(argstr="-maxscl %f"), + maxshf=dict(argstr="-maxshf %f"), + maxshr=dict(argstr="-maxshr %f"), + newgrid=dict(argstr="-newgrid %f"), + nmatch=dict(argstr="-nmatch %d"), + no_pad=dict(argstr="-nopad"), + nomask=dict(argstr="-nomask"), + num_threads=dict(nohash=True, usedefault=True), + nwarp=dict(argstr="-nwarp %s"), + nwarp_fixdep=dict(argstr="-nwarp_fixdep%s..."), + nwarp_fixmot=dict(argstr="-nwarp_fixmot%s..."), + one_pass=dict(argstr="-onepass"), out_file=dict( argstr="-prefix %s", extensions=None, @@ -58,35 +58,40 @@ def test_Allineate_inputs(): xor=["allcostx"], ), out_matrix=dict( - argstr="-1Dmatrix_save %s", extensions=None, xor=["in_matrix", "allcostx"], + argstr="-1Dmatrix_save %s", + extensions=None, + keep_extension=False, + name_source="in_file", + name_template="%s_allineated.aff12.1D", + xor=["in_matrix", "allcostx"], ), out_param_file=dict( argstr="-1Dparam_save %s", extensions=None, xor=["in_param_file", "allcostx"], ), - out_weight_file=dict(argstr="-wtprefix %s", extensions=None, xor=["allcostx"],), + out_weight_file=dict(argstr="-wtprefix %s", extensions=None, xor=["allcostx"]), outputtype=dict(), - overwrite=dict(argstr="-overwrite",), - quiet=dict(argstr="-quiet",), - reference=dict(argstr="-base %s", extensions=None,), - replacebase=dict(argstr="-replacebase",), - replacemeth=dict(argstr="-replacemeth %s",), - source_automask=dict(argstr="-source_automask+%d",), - source_mask=dict(argstr="-source_mask %s", extensions=None,), - two_best=dict(argstr="-twobest %d",), - two_blur=dict(argstr="-twoblur %f",), - two_first=dict(argstr="-twofirst",), - two_pass=dict(argstr="-twopass",), - usetemp=dict(argstr="-usetemp",), - verbose=dict(argstr="-verb",), - warp_type=dict(argstr="-warp %s",), - warpfreeze=dict(argstr="-warpfreeze",), - weight=dict(argstr="-weight %s",), + overwrite=dict(argstr="-overwrite"), + quiet=dict(argstr="-quiet"), + reference=dict(argstr="-base %s", extensions=None), + replacebase=dict(argstr="-replacebase"), + replacemeth=dict(argstr="-replacemeth %s"), + source_automask=dict(argstr="-source_automask+%d"), + source_mask=dict(argstr="-source_mask %s", extensions=None), + two_best=dict(argstr="-twobest %d"), + two_blur=dict(argstr="-twoblur %f"), + two_first=dict(argstr="-twofirst"), + two_pass=dict(argstr="-twopass"), + usetemp=dict(argstr="-usetemp"), + verbose=dict(argstr="-verb"), + warp_type=dict(argstr="-warp %s"), + warpfreeze=dict(argstr="-warpfreeze"), + weight=dict(argstr="-weight %s"), weight_file=dict( - argstr="-weight %s", deprecated="1.0.0", extensions=None, new_name="weight", + argstr="-weight %s", deprecated="1.0.0", extensions=None, new_name="weight" ), - zclip=dict(argstr="-zclip",), + zclip=dict(argstr="-zclip"), ) inputs = Allineate.input_spec() @@ -97,11 +102,11 @@ def test_Allineate_inputs(): def test_Allineate_outputs(): output_map = dict( - allcostx=dict(extensions=None,), - out_file=dict(extensions=None,), - out_matrix=dict(extensions=None,), - out_param_file=dict(extensions=None,), - out_weight_file=dict(extensions=None,), + allcostx=dict(extensions=None), + out_file=dict(extensions=None), + out_matrix=dict(extensions=None), + out_param_file=dict(extensions=None), + out_weight_file=dict(extensions=None), ) outputs = Allineate.output_spec() From 7961a5426e0cd917f54ff6633828a24ccd21b74f Mon Sep 17 00:00:00 2001 From: salma1601 Date: Sun, 5 Jan 2020 22:09:28 +0100 Subject: [PATCH 3/5] fix doctest --- nipype/interfaces/afni/preprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index ba33994684..1c5f590262 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -579,7 +579,7 @@ class Allineate(AFNICommand): >>> allineate.inputs.reference = 'structural.nii' >>> allineate.inputs.nwarp_fixmot = ['X', 'Y'] >>> allineate.cmdline - '3dAllineate -source functional.nii -nwarp_fixmotX -nwarp_fixmotY -prefix functional_allineate -base structural.nii' + '3dAllineate -source functional.nii -nwarp_fixmotX -nwarp_fixmotY -prefix functional_allineate -1Dmatrix_save functional_allineated.aff12 -base structural.nii' >>> res = allineate.run() # doctest: +SKIP """ From 5d68df6b74e5ff28fc999f5d30e86587b4dd5621 Mon Sep 17 00:00:00 2001 From: salma1601 Date: Sun, 5 Jan 2020 22:26:21 +0100 Subject: [PATCH 4/5] split long line --- nipype/interfaces/afni/preprocess.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 1c5f590262..faff6aa8ad 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -579,7 +579,8 @@ class Allineate(AFNICommand): >>> allineate.inputs.reference = 'structural.nii' >>> allineate.inputs.nwarp_fixmot = ['X', 'Y'] >>> allineate.cmdline - '3dAllineate -source functional.nii -nwarp_fixmotX -nwarp_fixmotY -prefix functional_allineate -1Dmatrix_save functional_allineated.aff12 -base structural.nii' + '3dAllineate -source functional.nii -nwarp_fixmotX -nwarp_fixmotY -prefix functional_allineate \ +-1Dmatrix_save functional_allineated.aff12 -base structural.nii' >>> res = allineate.run() # doctest: +SKIP """ From 85aeffcd4938b252c4c7f4dcd17070cdfa8e96b4 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sun, 23 Feb 2020 20:51:44 -0500 Subject: [PATCH 5/5] TEST: make specs --- .../afni/tests/test_auto_Allineate.py | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/nipype/interfaces/afni/tests/test_auto_Allineate.py b/nipype/interfaces/afni/tests/test_auto_Allineate.py index 7c4f74718c..2438dd2cae 100644 --- a/nipype/interfaces/afni/tests/test_auto_Allineate.py +++ b/nipype/interfaces/afni/tests/test_auto_Allineate.py @@ -10,20 +10,20 @@ def test_Allineate_inputs(): position=-1, xor=["out_file", "out_matrix", "out_param_file", "out_weight_file"], ), - args=dict(argstr="%s"), - autobox=dict(argstr="-autobox"), - automask=dict(argstr="-automask+%d"), - autoweight=dict(argstr="-autoweight%s"), - center_of_mass=dict(argstr="-cmass%s"), - check=dict(argstr="-check %s"), - convergence=dict(argstr="-conv %f"), - cost=dict(argstr="-cost %s"), - environ=dict(nohash=True, usedefault=True), - epi=dict(argstr="-EPI"), - final_interpolation=dict(argstr="-final %s"), - fine_blur=dict(argstr="-fineblur %f"), + args=dict(argstr="%s",), + autobox=dict(argstr="-autobox",), + automask=dict(argstr="-automask+%d",), + autoweight=dict(argstr="-autoweight%s",), + center_of_mass=dict(argstr="-cmass%s",), + check=dict(argstr="-check %s",), + convergence=dict(argstr="-conv %f",), + cost=dict(argstr="-cost %s",), + environ=dict(nohash=True, usedefault=True,), + epi=dict(argstr="-EPI",), + final_interpolation=dict(argstr="-final %s",), + fine_blur=dict(argstr="-fineblur %f",), in_file=dict( - argstr="-source %s", copyfile=False, extensions=None, mandatory=True + argstr="-source %s", copyfile=False, extensions=None, mandatory=True, ), in_matrix=dict( argstr="-1Dmatrix_apply %s", @@ -32,23 +32,23 @@ def test_Allineate_inputs(): xor=["out_matrix"], ), in_param_file=dict( - argstr="-1Dparam_apply %s", extensions=None, xor=["out_param_file"] + argstr="-1Dparam_apply %s", extensions=None, xor=["out_param_file"], ), - interpolation=dict(argstr="-interp %s"), - master=dict(argstr="-master %s", extensions=None), - maxrot=dict(argstr="-maxrot %f"), - maxscl=dict(argstr="-maxscl %f"), - maxshf=dict(argstr="-maxshf %f"), - maxshr=dict(argstr="-maxshr %f"), - newgrid=dict(argstr="-newgrid %f"), - nmatch=dict(argstr="-nmatch %d"), - no_pad=dict(argstr="-nopad"), - nomask=dict(argstr="-nomask"), - num_threads=dict(nohash=True, usedefault=True), - nwarp=dict(argstr="-nwarp %s"), - nwarp_fixdep=dict(argstr="-nwarp_fixdep%s..."), - nwarp_fixmot=dict(argstr="-nwarp_fixmot%s..."), - one_pass=dict(argstr="-onepass"), + interpolation=dict(argstr="-interp %s",), + master=dict(argstr="-master %s", extensions=None,), + maxrot=dict(argstr="-maxrot %f",), + maxscl=dict(argstr="-maxscl %f",), + maxshf=dict(argstr="-maxshf %f",), + maxshr=dict(argstr="-maxshr %f",), + newgrid=dict(argstr="-newgrid %f",), + nmatch=dict(argstr="-nmatch %d",), + no_pad=dict(argstr="-nopad",), + nomask=dict(argstr="-nomask",), + num_threads=dict(nohash=True, usedefault=True,), + nwarp=dict(argstr="-nwarp %s",), + nwarp_fixdep=dict(argstr="-nwarp_fixdep%s...",), + nwarp_fixmot=dict(argstr="-nwarp_fixmot%s...",), + one_pass=dict(argstr="-onepass",), out_file=dict( argstr="-prefix %s", extensions=None, @@ -70,28 +70,28 @@ def test_Allineate_inputs(): extensions=None, xor=["in_param_file", "allcostx"], ), - out_weight_file=dict(argstr="-wtprefix %s", extensions=None, xor=["allcostx"]), + out_weight_file=dict(argstr="-wtprefix %s", extensions=None, xor=["allcostx"],), outputtype=dict(), - overwrite=dict(argstr="-overwrite"), - quiet=dict(argstr="-quiet"), - reference=dict(argstr="-base %s", extensions=None), - replacebase=dict(argstr="-replacebase"), - replacemeth=dict(argstr="-replacemeth %s"), - source_automask=dict(argstr="-source_automask+%d"), - source_mask=dict(argstr="-source_mask %s", extensions=None), - two_best=dict(argstr="-twobest %d"), - two_blur=dict(argstr="-twoblur %f"), - two_first=dict(argstr="-twofirst"), - two_pass=dict(argstr="-twopass"), - usetemp=dict(argstr="-usetemp"), - verbose=dict(argstr="-verb"), - warp_type=dict(argstr="-warp %s"), - warpfreeze=dict(argstr="-warpfreeze"), - weight=dict(argstr="-weight %s"), + overwrite=dict(argstr="-overwrite",), + quiet=dict(argstr="-quiet",), + reference=dict(argstr="-base %s", extensions=None,), + replacebase=dict(argstr="-replacebase",), + replacemeth=dict(argstr="-replacemeth %s",), + source_automask=dict(argstr="-source_automask+%d",), + source_mask=dict(argstr="-source_mask %s", extensions=None,), + two_best=dict(argstr="-twobest %d",), + two_blur=dict(argstr="-twoblur %f",), + two_first=dict(argstr="-twofirst",), + two_pass=dict(argstr="-twopass",), + usetemp=dict(argstr="-usetemp",), + verbose=dict(argstr="-verb",), + warp_type=dict(argstr="-warp %s",), + warpfreeze=dict(argstr="-warpfreeze",), + weight=dict(argstr="-weight %s",), weight_file=dict( - argstr="-weight %s", deprecated="1.0.0", extensions=None, new_name="weight" + argstr="-weight %s", deprecated="1.0.0", extensions=None, new_name="weight", ), - zclip=dict(argstr="-zclip"), + zclip=dict(argstr="-zclip",), ) inputs = Allineate.input_spec() @@ -102,11 +102,11 @@ def test_Allineate_inputs(): def test_Allineate_outputs(): output_map = dict( - allcostx=dict(extensions=None), - out_file=dict(extensions=None), - out_matrix=dict(extensions=None), - out_param_file=dict(extensions=None), - out_weight_file=dict(extensions=None), + allcostx=dict(extensions=None,), + out_file=dict(extensions=None,), + out_matrix=dict(extensions=None,), + out_param_file=dict(extensions=None,), + out_weight_file=dict(extensions=None,), ) outputs = Allineate.output_spec()