Skip to content

Commit 9b71e71

Browse files
committed
[FIX]: AFNI Allineate conflicts with master
Edited AFNI Allineate interface to accommodate updated master branch. Updated xor options for allcostx.
1 parent ec87379 commit 9b71e71

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,12 @@ class AllineateInputSpec(AFNICommandInputSpec):
220220
out_file = File(
221221
desc='output file from 3dAllineate',
222222
argstr='-prefix %s',
223-
name_source='in_file',
224-
name_template='%s_allineate',
225223
genfile=True,
226224
xor=['allcostx'])
227225
out_param_file = File(
228226
argstr='-1Dparam_save %s',
229227
desc='Save the warp parameters in ASCII (.1D) format.',
230-
xor=['in_param_file'])
228+
xor=['in_param_file','allcostx'])
231229
in_param_file = File(
232230
exists=True,
233231
argstr='-1Dparam_apply %s',
@@ -237,7 +235,7 @@ class AllineateInputSpec(AFNICommandInputSpec):
237235
out_matrix = File(
238236
argstr='-1Dmatrix_save %s',
239237
desc='Save the transformation matrix for each volume.',
240-
xor=['in_matrix'])
238+
xor=['in_matrix','allcostx'])
241239
in_matrix = File(
242240
desc='matrix to align input file',
243241
argstr='-1Dmatrix_apply %s',
@@ -247,14 +245,12 @@ class AllineateInputSpec(AFNICommandInputSpec):
247245
desc='overwrite output file if it already exists',
248246
argstr='-overwrite')
249247

250-
# TODO: implement sensible xors for allcostx and suppres prefix in command when allcosx is used
251248
allcostx= File(
252249
desc='Compute and print ALL available cost functionals for the un-warped inputs'
253250
'AND THEN QUIT. If you use this option none of the other expected outputs will be produced',
254251
argstr='-allcostx |& tee %s',
255252
position=-1,
256-
xor=['out_file'])
257-
253+
xor=['out_file', 'out_matrix', 'out_param_file', 'out_weight_file'])
258254
_cost_funcs = [
259255
'leastsq', 'ls',
260256
'mutualinfo', 'mi',
@@ -365,7 +361,8 @@ class AllineateInputSpec(AFNICommandInputSpec):
365361
'Must be defined on the same grid as the base dataset')
366362
out_weight_file = traits.File(
367363
argstr='-wtprefix %s',
368-
desc='Write the weight volume to disk as a dataset')
364+
desc='Write the weight volume to disk as a dataset',
365+
xor=['allcostx'])
369366
source_mask = File(
370367
exists=True,
371368
argstr='-source_mask %s',
@@ -445,7 +442,7 @@ class Allineate(AFNICommand):
445442
>>> allineate.inputs.out_file = 'functional_allineate.nii'
446443
>>> allineate.inputs.in_matrix = 'cmatrix.mat'
447444
>>> allineate.cmdline # doctest: +ALLOW_UNICODE
448-
'3dAllineate -source functional.nii -1Dmatrix_apply cmatrix.mat -prefix functional_allineate.nii'
445+
'3dAllineate -source functional.nii -prefix functional_allineate.nii -1Dmatrix_apply cmatrix.mat'
449446
>>> res = allineate.run() # doctest: +SKIP
450447
451448
>>> from nipype.interfaces import afni
@@ -454,7 +451,7 @@ class Allineate(AFNICommand):
454451
>>> allineate.inputs.reference = 'structural.nii'
455452
>>> allineate.inputs.allcostx = 'out.allcostX.txt'
456453
>>> allineate.cmdline # doctest: +ALLOW_UNICODE
457-
'3dAllineate -source functional.nii -prefix functional_allineate -base structural.nii -allcostx |& tee out.allcostX.txt'
454+
'3dAllineate -source functional.nii -base structural.nii -allcostx |& tee out.allcostX.txt'
458455
>>> res = allineate.run() # doctest: +SKIP
459456
"""
460457

@@ -493,8 +490,8 @@ def _list_outputs(self):
493490
else:
494491
outputs['out_param_file'] = op.abspath(self.inputs.out_param_file)
495492

496-
if isdefined(self.inputs.allcostX):
497-
outputs['allcostX'] = os.path.abspath(os.path.join(os.getcwd(),\
493+
if isdefined(self.inputs.allcostx):
494+
outputs['allcostX'] = os.path.abspath(os.path.join(os.getcwd(),
498495
self.inputs.allcostx))
499496
return outputs
500497

nipype/interfaces/afni/tests/test_auto_Allineate.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def test_Allineate_inputs():
77
input_map = dict(allcostx=dict(argstr='-allcostx |& tee %s',
88
position=-1,
9-
xor=['out_file'],
9+
xor=['out_file', 'out_matrix', 'out_param_file', 'out_weight_file'],
1010
),
1111
args=dict(argstr='%s',
1212
),
@@ -69,17 +69,16 @@ def test_Allineate_inputs():
6969
),
7070
out_file=dict(argstr='-prefix %s',
7171
genfile=True,
72-
name_source='in_file',
73-
name_template='%s_allineate',
7472
xor=['allcostx'],
7573
),
7674
out_matrix=dict(argstr='-1Dmatrix_save %s',
77-
xor=['in_matrix'],
75+
xor=['in_matrix', 'allcostx'],
7876
),
7977
out_param_file=dict(argstr='-1Dparam_save %s',
80-
xor=['in_param_file'],
78+
xor=['in_param_file', 'allcostx'],
8179
),
8280
out_weight_file=dict(argstr='-wtprefix %s',
81+
xor=['allcostx'],
8382
),
8483
outputtype=dict(),
8584
overwrite=dict(argstr='-overwrite',

0 commit comments

Comments
 (0)