@@ -2406,6 +2406,170 @@ class TNorm(AFNICommand):
2406
2406
output_spec = AFNICommandOutputSpec
2407
2407
2408
2408
2409
+ class TProjectInputSpec (AFNICommandInputSpec ):
2410
+ in_file = File (
2411
+ desc = 'input file to 3dTproject' ,
2412
+ argstr = '%s' ,
2413
+ position = 1 ,
2414
+ mandatory = True ,
2415
+ exists = True ,
2416
+ copyfile = False )
2417
+ out_file = File (
2418
+ name_template = '%s_tproject' ,
2419
+ desc = 'output image file name' ,
2420
+ position = - 1 ,
2421
+ argstr = '-prefix %s' ,
2422
+ name_source = 'in_file' )
2423
+ censor = File (
2424
+ desc = """filename of censor .1D time series
2425
+ * This is a file of 1s and 0s, indicating which
2426
+ time points are to be included (1) and which are
2427
+ to be excluded (0).""" ,
2428
+ argstr = "-censor %s" )
2429
+ censortr = traits .List (
2430
+ traits .Str (),
2431
+ desc = """list of strings that specify time indexes
2432
+ to be removed from the analysis. Each string is
2433
+ of one of the following forms:
2434
+ 37 => remove global time index #37
2435
+ 2:37 => remove time index #37 in run #2
2436
+ 37..47 => remove global time indexes #37-47
2437
+ 37-47 => same as above
2438
+ 2:37..47 => remove time indexes #37-47 in run #2
2439
+ *:0-2 => remove time indexes #0-2 in all runs
2440
+ +Time indexes within each run start at 0.
2441
+ +Run indexes start at 1 (just be to confusing).
2442
+ +N.B.: 2:37,47 means index #37 in run #2 and
2443
+ global time index 47; it does NOT mean
2444
+ index #37 in run #2 AND index #47 in run #2.""" ,
2445
+ argstr = "-CENSORTR %s" )
2446
+ cenmode = traits .Enum (
2447
+ 'KILL' , 'ZERO' , 'NTRP' ,
2448
+ desc = """specifies how censored time points are treated in
2449
+ the output dataset:
2450
+ + mode = ZERO ==> put zero values in their place
2451
+ ==> output datset is same length as input
2452
+ + mode = KILL ==> remove those time points
2453
+ ==> output dataset is shorter than input
2454
+ + mode = NTRP ==> censored values are replaced by interpolated
2455
+ neighboring (in time) non-censored values,
2456
+ BEFORE any projections, and then the
2457
+ analysis proceeds without actual removal
2458
+ of any time points -- this feature is to
2459
+ keep the Spanish Inquisition happy.
2460
+ * The default mode is KILL !!!""" ,
2461
+ argstr = '-cenmode %s' )
2462
+ concat = File (
2463
+ desc = """The catenation file, as in 3dDeconvolve, containing the
2464
+ TR indexes of the start points for each contiguous run
2465
+ within the input dataset (the first entry should be 0).
2466
+ ++ Also as in 3dDeconvolve, if the input dataset is
2467
+ automatically catenated from a collection of datasets,
2468
+ then the run start indexes are determined directly,
2469
+ and '-concat' is not needed (and will be ignored).
2470
+ ++ Each run must have at least 9 time points AFTER
2471
+ censoring, or the program will not work!
2472
+ ++ The only use made of this input is in setting up
2473
+ the bandpass/stopband regressors.
2474
+ ++ '-ort' and '-dsort' regressors run through all time
2475
+ points, as read in. If you want separate projections
2476
+ in each run, then you must either break these ort files
2477
+ into appropriate components, OR you must run 3dTproject
2478
+ for each run separately, using the appropriate pieces
2479
+ from the ort files via the '{...}' selector for the
2480
+ 1D files and the '[...]' selector for the datasets.""" ,
2481
+ exists = True ,
2482
+ argstr = '-concat %s' )
2483
+ noblock = traits .Bool (
2484
+ desc = """Also as in 3dDeconvolve, if you want the program to treat
2485
+ an auto-catenated dataset as one long run, use this option.
2486
+ ++ However, '-noblock' will not affect catenation if you use
2487
+ the '-concat' option.""" ,
2488
+ argstr = '-noblock' )
2489
+ ort = File (
2490
+ desc = """Remove each column in file
2491
+ ++ Each column will have its mean removed.""" ,
2492
+ exist = True ,
2493
+ argstr = "-ort %s" )
2494
+ polort = traits .Int (
2495
+ desc = """Remove polynomials up to and including degree pp.
2496
+ ++ Default value is 2.
2497
+ ++ It makes no sense to use a value of pp greater than
2498
+ 2, if you are bandpassing out the lower frequencies!
2499
+ ++ For catenated datasets, each run gets a separate set
2500
+ set of pp+1 Legendre polynomial regressors.
2501
+ ++ Use of -polort -1 is not advised (if data mean != 0),
2502
+ even if -ort contains constant terms, as all means are
2503
+ removed.""" ,
2504
+ argstr = "-polort %d" )
2505
+ bandpass = traits .Tuple (
2506
+ traits .Float , traits .Float ,
2507
+ desc = """Remove all frequencies EXCEPT those in the range""" ,
2508
+ argstr = '-bandpass %f %f' )
2509
+ stopband = traits .Tuple (
2510
+ traits .Float , traits .Float ,
2511
+ desc = """Remove all frequencies in the range""" ,
2512
+ argstr = '-stopband %f %f' )
2513
+ TR = traits .Float (
2514
+ desc = """Use time step dd for the frequency calculations,
2515
+ rather than the value stored in the dataset header.""" ,
2516
+ argstr = '-TR %f' )
2517
+ mask = File (
2518
+ exist = True ,
2519
+ desc = """Only operate on voxels nonzero in the mset dataset.
2520
+ ++ Voxels outside the mask will be filled with zeros.
2521
+ ++ If no masking option is given, then all voxels
2522
+ will be processed.""" ,
2523
+ argstr = '-mask %s' )
2524
+ automask = traits .Bool (
2525
+ desc = """Generate a mask automatically""" ,
2526
+ xor = ['mask' ],
2527
+ argstr = '-automask' )
2528
+ blur = traits .Float (
2529
+ desc = """Blur (inside the mask only) with a filter that has
2530
+ width (FWHM) of fff millimeters.
2531
+ ++ Spatial blurring (if done) is after the time
2532
+ series filtering.""" ,
2533
+ argstr = '-blur %f' )
2534
+ norm = traits .Bool (
2535
+ desc = """Normalize each output time series to have sum of
2536
+ squares = 1. This is the LAST operation.""" ,
2537
+ argstr = '-norm' )
2538
+
2539
+
2540
+ class TProject (AFNICommand ):
2541
+ """
2542
+ This program projects (detrends) out various 'nuisance' time series from
2543
+ each voxel in the input dataset. Note that all the projections are done
2544
+ via linear regression, including the frequency-based options such
2545
+ as '-passband'. In this way, you can bandpass time-censored data, and at
2546
+ the same time, remove other time series of no interest
2547
+ (e.g., physiological estimates, motion parameters).
2548
+ Shifts voxel time series from input so that seperate slices are aligned to
2549
+ the same temporal origin.
2550
+
2551
+ For complete details, see the `3dTproject Documentation.
2552
+ <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dTproject.html>`_
2553
+
2554
+ Examples
2555
+ ========
2556
+
2557
+ >>> from nipype.interfaces import afni
2558
+ >>> tproject = afni.TProject()
2559
+ >>> tproject.inputs.in_file = 'functional.nii'
2560
+ >>> tproject.inputs.bandpass = (0.00667, 99999)
2561
+ >>> tproject.inputs.polort = 3
2562
+ >>> tproject.inputs.automask = True
2563
+ >>> tproject.inputs.out_file = 'projected.nii.gz'
2564
+ >>> tproject.cmdline
2565
+ '3dTproject functional.nii -automask -bandpass 0.006670 99999.000000 -polort 3 -prefix projected.nii.gz'
2566
+ >>> res = tproject.run() # doctest: +SKIP
2567
+
2568
+ """
2569
+ _cmd = '3dTproject'
2570
+ input_spec = TProjectInputSpec
2571
+ output_spec = AFNICommandOutputSpec
2572
+
2409
2573
class TShiftInputSpec (AFNICommandInputSpec ):
2410
2574
in_file = File (
2411
2575
desc = 'input file to 3dTShift' ,
0 commit comments