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