@@ -1381,3 +1381,66 @@ class ZCutUp(AFNICommand):
1381
1381
_cmd = '3dZcutup'
1382
1382
input_spec = ZCutUpInputSpec
1383
1383
output_spec = AFNICommandOutputSpec
1384
+
1385
+
1386
+ class GCORInputSpec (CommandLineInputSpec ):
1387
+ in_file = File (
1388
+ desc = 'input dataset to compute the GCOR over' ,
1389
+ argstr = '-input %s' ,
1390
+ position = - 1 ,
1391
+ mandatory = True ,
1392
+ exists = True ,
1393
+ copyfile = False )
1394
+
1395
+ in_mask = File (
1396
+ desc = 'mask dataset, for restricting the computation' ,
1397
+ argstr = '-mask %s' ,
1398
+ exists = True ,
1399
+ copyfile = False )
1400
+
1401
+ nfirst = traits .Int (0 , argstr = '-nfirst %d' ,
1402
+ desc = 'specify number of initial TRs to ignore' )
1403
+ no_demean = traits .Bool (False , argstr = '-no_demean' ,
1404
+ desc = 'do not (need to) demean as first step' )
1405
+
1406
+
1407
+ class GCOROutputSpec (TraitedSpec ):
1408
+ out = traits .Float (desc = 'global correlation value' )
1409
+
1410
+
1411
+ class GCOR (CommandLine ):
1412
+ """
1413
+ Computes the average correlation between every voxel
1414
+ and ever other voxel, over any give mask.
1415
+
1416
+
1417
+ For complete details, see the `@compute_gcor Documentation.
1418
+ <https://afni.nimh.nih.gov/pub/dist/doc/program_help/@compute_gcor.html>`_
1419
+
1420
+ Examples
1421
+ ========
1422
+
1423
+ >>> from nipype.interfaces import afni
1424
+ >>> gcor = afni.GCOR()
1425
+ >>> gcor.inputs.in_file = 'structural.nii'
1426
+ >>> gcor.inputs.nfirst = 4
1427
+ >>> gcor.cmdline # doctest: +ALLOW_UNICODE
1428
+ '@compute_gcor -nfirst 4 -input structural.nii'
1429
+ >>> res = gcor.run() # doctest: +SKIP
1430
+
1431
+ """
1432
+
1433
+ _cmd = '@compute_gcor'
1434
+ input_spec = GCORInputSpec
1435
+ output_spec = GCOROutputSpec
1436
+
1437
+ def _run_interface (self , runtime ):
1438
+ runtime = super (GCOR , self )._run_interface (runtime )
1439
+
1440
+ gcor_line = [line .strip () for line in runtime .stdout .split ('\n ' )
1441
+ if line .strip ().startswith ('GCOR = ' )][- 1 ]
1442
+ setattr (self , '_gcor' , float (gcor_line [len ('GCOR = ' ):]))
1443
+ return runtime
1444
+
1445
+ def _list_outputs (self ):
1446
+ return {'out' : getattr (self , '_gcor' )}
0 commit comments