Skip to content

Commit 27ba736

Browse files
ShotgunosineDylan
authored andcommitted
[ENH] Add 3dTnorm interface
1 parent 53cc8dd commit 27ba736

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

nipype/interfaces/afni/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
Maskave, Means, OutlierCount,
1717
QualityIndex, ROIStats, Retroicor,
1818
Seg, SkullStrip, TCorr1D, TCorrMap, TCorrelate,
19+
TNorm,
1920
TShift, Volreg, Warp, QwarpPlusMinus, Qwarp)
2021
from .svm import (SVMTest, SVMTrain)
2122
from .utils import (ABoverlap, AFNItoNIFTI, Autobox, Axialize, BrickStat, Bucket,

nipype/interfaces/afni/preprocess.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,6 +2402,67 @@ class TCorrelate(AFNICommand):
24022402
output_spec = AFNICommandOutputSpec
24032403

24042404

2405+
class TNormInputSpec(AFNICommandInputSpec):
2406+
in_file = File(
2407+
desc='input file to 3dTNorm',
2408+
argstr='%s',
2409+
position=-1,
2410+
mandatory=True,
2411+
exists=True,
2412+
copyfile=False)
2413+
out_file = File(
2414+
name_template='%s_tnorm',
2415+
desc='output image file name',
2416+
argstr='-prefix %s',
2417+
name_source='in_file')
2418+
norm2 = traits.Bool(
2419+
desc='L2 normalize (sum of squares = 1) [DEFAULT]',
2420+
argstr='-norm2')
2421+
normR = traits.Bool(
2422+
desc='normalize so sum of squares = number of time points * e.g., so RMS = 1.',
2423+
argstr='-normR')
2424+
norm1 = traits.Bool(
2425+
desc='L1 normalize (sum of absolute values = 1)',
2426+
argstr='-norm1')
2427+
normx = traits.Bool(
2428+
desc='Scale so max absolute value = 1 (L_infinity norm)',
2429+
argstr='-normx')
2430+
polort = traits.Int(
2431+
desc="""Detrend with polynomials of order p before normalizing
2432+
[DEFAULT = don't do this]
2433+
* Use '-polort 0' to remove the mean, for example""",
2434+
argstr='-polort %s')
2435+
L1fit = traits.Bool(
2436+
desc="""Detrend with L1 regression (L2 is the default)
2437+
* This option is here just for the hell of it""",
2438+
argstr='-L1fit')
2439+
2440+
2441+
class TNorm(AFNICommand):
2442+
"""Shifts voxel time series from input so that seperate slices are aligned
2443+
to the same temporal origin.
2444+
2445+
For complete details, see the `3dTshift Documentation.
2446+
<https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dTshift.html>`_
2447+
2448+
Examples
2449+
========
2450+
2451+
>>> from nipype.interfaces import afni
2452+
>>> tnorm = afni.TNorm()
2453+
>>> tnorm.inputs.in_file = 'functional.nii'
2454+
>>> tnorm.inputs.norm2 = True
2455+
>>> tnorm.inputs.out_file = 'rm.errts.unit errts+tlrc'
2456+
>>> tnorm.cmdline # doctest: +ALLOW_UNICODE
2457+
'3dTnorm -norm2 -prefix rm.errts.unit errts+tlrc functional.nii'
2458+
>>> res = tshift.run() # doctest: +SKIP
2459+
2460+
"""
2461+
_cmd = '3dTnorm'
2462+
input_spec = TNormInputSpec
2463+
output_spec = AFNICommandOutputSpec
2464+
2465+
24052466
class TShiftInputSpec(AFNICommandInputSpec):
24062467
in_file = File(
24072468
desc='input file to 3dTShift',

0 commit comments

Comments
 (0)