From cb96c1e30d89705806464f4d4b45df1eee12522b Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Wed, 20 Jun 2018 14:54:29 -0400 Subject: [PATCH 1/3] add -dsort option to TProject --- nipype/interfaces/afni/preprocess.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index cab527563a..b1f498381c 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -2492,6 +2492,14 @@ class TProjectInputSpec(AFNICommandInputSpec): even if -ort contains constant terms, as all means are removed.""", argstr="-polort %d") + dsort = File( + desc="""Remove the 3D+time time series in dataset fset. + ++ That is, 'fset' contains a different nuisance time + series for each voxel (e.g., from AnatICOR). + ++ Multiple -dsort options are allowed.""", + argstr='-dsort %s', + exists=True, + copyfile=False) bandpass = traits.Tuple( traits.Float, traits.Float, desc="""Remove all frequencies EXCEPT those in the range""", From 76203b25c6ae395257bcec09c016c6f13902f0e1 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Thu, 21 Jun 2018 13:33:28 -0400 Subject: [PATCH 2/3] modified to handle multiple dsort files --- nipype/interfaces/afni/preprocess.py | 21 ++++++++++++------- .../afni/tests/test_auto_TProject.py | 1 + .../ants/tests/test_auto_AntsJointFusion.py | 4 ++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index b1f498381c..f722f7557f 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -13,7 +13,8 @@ from ...utils.filemanip import (load_json, save_json, split_filename, fname_presuffix) from ..base import (CommandLineInputSpec, CommandLine, TraitedSpec, traits, - isdefined, File, InputMultiPath, Undefined, Str) + isdefined, File, InputMultiPath, Undefined, Str, + InputMultiObject) from .base import (AFNICommandBase, AFNICommand, AFNICommandInputSpec, AFNICommandOutputSpec, AFNIPythonCommandInputSpec, @@ -2492,14 +2493,15 @@ class TProjectInputSpec(AFNICommandInputSpec): even if -ort contains constant terms, as all means are removed.""", argstr="-polort %d") - dsort = File( + dsort = InputMultiObject( + File( + exists=True, + copyfile=False), + argstr="%s", desc="""Remove the 3D+time time series in dataset fset. ++ That is, 'fset' contains a different nuisance time - series for each voxel (e.g., from AnatICOR). - ++ Multiple -dsort options are allowed.""", - argstr='-dsort %s', - exists=True, - copyfile=False) + series for each voxel (e.g., from AnatICOR). + ++ Multiple -dsort options are allowed.""") bandpass = traits.Tuple( traits.Float, traits.Float, desc="""Remove all frequencies EXCEPT those in the range""", @@ -2567,6 +2569,11 @@ class TProject(AFNICommand): _cmd = '3dTproject' input_spec = TProjectInputSpec output_spec = AFNICommandOutputSpec + + def _format_arg(self, name, spec, value): + if name == 'dsort': + return ' '.join(["-dsort %s" % dsort_file for dsort_file in value]) + return super(TProject, self)._format_arg(name, spec, value) class TShiftInputSpec(AFNICommandInputSpec): in_file = File( diff --git a/nipype/interfaces/afni/tests/test_auto_TProject.py b/nipype/interfaces/afni/tests/test_auto_TProject.py index ffca499ea5..41ad1eae5f 100644 --- a/nipype/interfaces/afni/tests/test_auto_TProject.py +++ b/nipype/interfaces/afni/tests/test_auto_TProject.py @@ -17,6 +17,7 @@ def test_TProject_inputs(): censor=dict(argstr='-censor %s', ), censortr=dict(argstr='-CENSORTR %s', ), concat=dict(argstr='-concat %s', ), + dsort=dict(argstr='%s', ), environ=dict( nohash=True, usedefault=True, diff --git a/nipype/interfaces/ants/tests/test_auto_AntsJointFusion.py b/nipype/interfaces/ants/tests/test_auto_AntsJointFusion.py index fe84354739..5fc924fed2 100644 --- a/nipype/interfaces/ants/tests/test_auto_AntsJointFusion.py +++ b/nipype/interfaces/ants/tests/test_auto_AntsJointFusion.py @@ -57,8 +57,8 @@ def test_AntsJointFusion_inputs(): hash_files=False, ), out_label_post_prob_name_format=dict( - requires=['out_label_fusion', 'out_intensity_fusion_name_format'], - ), + requires=['out_label_fusion', + 'out_intensity_fusion_name_format'], ), patch_metric=dict(argstr='-m %s', ), patch_radius=dict( argstr='-p %s', From 264f0e44dea785f17bf842161e62eb1cc6f8c786 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Wed, 27 Jun 2018 16:12:22 -0400 Subject: [PATCH 3/3] Use correct argstr for multiple dsorts --- nipype/interfaces/afni/preprocess.py | 6 +----- nipype/interfaces/afni/tests/test_auto_TProject.py | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index f722f7557f..5fea4835b0 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -2497,7 +2497,7 @@ class TProjectInputSpec(AFNICommandInputSpec): File( exists=True, copyfile=False), - argstr="%s", + argstr="-dsort %s...", desc="""Remove the 3D+time time series in dataset fset. ++ That is, 'fset' contains a different nuisance time series for each voxel (e.g., from AnatICOR). @@ -2570,10 +2570,6 @@ class TProject(AFNICommand): input_spec = TProjectInputSpec output_spec = AFNICommandOutputSpec - def _format_arg(self, name, spec, value): - if name == 'dsort': - return ' '.join(["-dsort %s" % dsort_file for dsort_file in value]) - return super(TProject, self)._format_arg(name, spec, value) class TShiftInputSpec(AFNICommandInputSpec): in_file = File( diff --git a/nipype/interfaces/afni/tests/test_auto_TProject.py b/nipype/interfaces/afni/tests/test_auto_TProject.py index 41ad1eae5f..7c3c2ee978 100644 --- a/nipype/interfaces/afni/tests/test_auto_TProject.py +++ b/nipype/interfaces/afni/tests/test_auto_TProject.py @@ -17,7 +17,7 @@ def test_TProject_inputs(): censor=dict(argstr='-censor %s', ), censortr=dict(argstr='-CENSORTR %s', ), concat=dict(argstr='-concat %s', ), - dsort=dict(argstr='%s', ), + dsort=dict(argstr='-dsort %s...', ), environ=dict( nohash=True, usedefault=True,