@@ -213,7 +213,6 @@ class AllineateInputSpec(AFNICommandInputSpec):
213
213
in_file = File (
214
214
desc = 'input file to 3dAllineate' ,
215
215
argstr = '-source %s' ,
216
- position = - 1 ,
217
216
mandatory = True ,
218
217
exists = True ,
219
218
copyfile = False )
@@ -225,9 +224,10 @@ class AllineateInputSpec(AFNICommandInputSpec):
225
224
out_file = File (
226
225
desc = 'output file from 3dAllineate' ,
227
226
argstr = '-prefix %s' ,
228
- position = - 2 ,
229
- name_source = '%s_allineate' ,
230
- genfile = True )
227
+ name_source = 'in_file' ,
228
+ name_template = '%s_allineate' ,
229
+ genfile = True ,
230
+ xors = ['allcostx' ])
231
231
out_param_file = File (
232
232
argstr = '-1Dparam_save %s' ,
233
233
desc = 'Save the warp parameters in ASCII (.1D) format.' )
@@ -241,8 +241,14 @@ class AllineateInputSpec(AFNICommandInputSpec):
241
241
desc = 'Save the transformation matrix for each volume.' )
242
242
in_matrix = File (
243
243
desc = 'matrix to align input file' ,
244
- argstr = '-1Dmatrix_apply %s' ,
245
- position = - 3 )
244
+ argstr = '-1Dmatrix_apply %s' )
245
+ # TODO: implement sensible xors for allcostx and suppres prefix in command when allcosx is used
246
+ allcostx = File (
247
+ desc = 'Compute and print ALL available cost functionals for the un-warped inputs'
248
+ 'AND THEN QUIT. If you use this option none of the other expected outputs will be produced' ,
249
+ argstr = '-allcostx |& tee %s' ,
250
+ position = - 1 ,
251
+ xors = ['out_file' ])
246
252
247
253
_cost_funcs = [
248
254
'leastsq' , 'ls' ,
@@ -414,6 +420,7 @@ class AllineateInputSpec(AFNICommandInputSpec):
414
420
class AllineateOutputSpec (TraitedSpec ):
415
421
out_file = File (desc = 'output image file name' )
416
422
matrix = File (desc = 'matrix to align input file' )
423
+ allcostx = File (desc = 'Compute and print ALL available cost functionals for the un-warped inputs' )
417
424
418
425
419
426
class Allineate (AFNICommand ):
@@ -431,9 +438,17 @@ class Allineate(AFNICommand):
431
438
>>> allineate.inputs.out_file = 'functional_allineate.nii'
432
439
>>> allineate.inputs.in_matrix = 'cmatrix.mat'
433
440
>>> allineate.cmdline # doctest: +ALLOW_UNICODE
434
- '3dAllineate -1Dmatrix_apply cmatrix.mat -prefix functional_allineate.nii -source functional .nii'
441
+ '3dAllineate -source functional.nii - 1Dmatrix_apply cmatrix.mat -prefix functional_allineate.nii'
435
442
>>> res = allineate.run() # doctest: +SKIP
436
443
444
+ >>> from nipype.interfaces import afni
445
+ >>> allineate = afni.Allineate()
446
+ >>> allineate.inputs.in_file = 'functional.nii'
447
+ >>> allineate.inputs.reference = 'structural.nii'
448
+ >>> allineate.inputs.allcostx = 'out.allcostX.txt'
449
+ >>> allineate.cmdline # doctest: +ALLOW_UNICODE
450
+ '3dAllineate -source functional.nii -prefix functional_allineate -base structural.nii -allcostx |& tee out.allcostX.txt'
451
+ >>> res = allineate.run() # doctest: +SKIP
437
452
"""
438
453
439
454
_cmd = '3dAllineate'
@@ -457,6 +472,10 @@ def _list_outputs(self):
457
472
if isdefined (self .inputs .out_matrix ):
458
473
outputs ['matrix' ] = os .path .abspath (os .path .join (os .getcwd (),\
459
474
self .inputs .out_matrix + '.aff12.1D' ))
475
+
476
+ if isdefined (self .inputs .allcostX ):
477
+ outputs ['allcostX' ] = os .path .abspath (os .path .join (os .getcwd (),\
478
+ self .inputs .allcostx ))
460
479
return outputs
461
480
462
481
def _gen_filename (self , name ):
@@ -1520,14 +1539,17 @@ class MeansInputSpec(AFNICommandInputSpec):
1520
1539
in_file_a = File (
1521
1540
desc = 'input file to 3dMean' ,
1522
1541
argstr = '%s' ,
1523
- position = 0 ,
1542
+ position = - 2 ,
1524
1543
mandatory = True ,
1525
1544
exists = True )
1526
1545
in_file_b = File (
1527
1546
desc = 'another input file to 3dMean' ,
1528
1547
argstr = '%s' ,
1529
- position = 1 ,
1548
+ position = - 1 ,
1530
1549
exists = True )
1550
+ datum = traits .Str (
1551
+ desc = 'Sets the data type of the output dataset' ,
1552
+ argstr = '-datum %s' )
1531
1553
out_file = File (
1532
1554
name_template = '%s_mean' ,
1533
1555
desc = 'output image file name' ,
@@ -1574,7 +1596,16 @@ class Means(AFNICommand):
1574
1596
>>> means.inputs.in_file_b = 'im2.nii'
1575
1597
>>> means.inputs.out_file = 'output.nii'
1576
1598
>>> means.cmdline # doctest: +ALLOW_UNICODE
1577
- '3dMean im1.nii im2.nii -prefix output.nii'
1599
+ '3dMean -prefix output.nii im1.nii im2.nii'
1600
+ >>> res = means.run() # doctest: +SKIP
1601
+
1602
+ >>> from nipype.interfaces import afni
1603
+ >>> means = afni.Means()
1604
+ >>> means.inputs.in_file_a = 'im1.nii'
1605
+ >>> means.inputs.out_file = 'output.nii'
1606
+ >>> means.inputs.datum = 'short'
1607
+ >>> means.cmdline # doctest: +ALLOW_UNICODE
1608
+ '3dMean -datum short -prefix output.nii im1.nii'
1578
1609
>>> res = means.run() # doctest: +SKIP
1579
1610
1580
1611
"""
0 commit comments