Skip to content

Commit ea74b63

Browse files
ShotgunosineDylan
authored andcommitted
[ENH] add minimal auto_TLRC interface
1 parent 4b587d6 commit ea74b63

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

nipype/interfaces/afni/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from .base import Info
1111
from .preprocess import (Allineate, Automask, AutoTcorrelate,
12+
AutoTLRC,
1213
Bandpass, BlurInMask, BlurToFWHM,
1314
ClipLevel, DegreeCentrality, Despike,
1415
Detrend, ECM, Fim, Fourier, Hist, LFCD,

nipype/interfaces/afni/preprocess.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,104 @@ class Automask(AFNICommand):
432432
input_spec = AutomaskInputSpec
433433
output_spec = AutomaskOutputSpec
434434

435+
class AutoTLRCInputSpec(CommandLineInputSpec):
436+
outputtype = traits.Enum('AFNI', list(Info.ftypes.keys()),
437+
desc='AFNI output filetype')
438+
in_file = File(
439+
desc='Original anatomical volume (+orig).'
440+
'The skull is removed by this script'
441+
'unless instructed otherwise (-no_ss).',
442+
argstr='-input %s',
443+
mandatory=True,
444+
exists=True,
445+
copyfile=False)
446+
base = traits.Str(
447+
desc = ' Reference anatomical volume'
448+
' Usually this volume is in some standard space like'
449+
' TLRC or MNI space and with afni dataset view of'
450+
' (+tlrc).'
451+
' Preferably, this reference volume should have had'
452+
' the skull removed but that is not mandatory.'
453+
' AFNI\'s distribution contains several templates.'
454+
' For a longer list, use "whereami -show_templates"'
455+
'TT_N27+tlrc --> Single subject, skull stripped volume.'
456+
' This volume is also known as '
457+
' N27_SurfVol_NoSkull+tlrc elsewhere in '
458+
' AFNI and SUMA land.'
459+
' (www.loni.ucla.edu, www.bic.mni.mcgill.ca)'
460+
' This template has a full set of FreeSurfer'
461+
' (surfer.nmr.mgh.harvard.edu)'
462+
' surface models that can be used in SUMA. '
463+
' For details, see Talairach-related link:'
464+
' https://afni.nimh.nih.gov/afni/suma'
465+
'TT_icbm452+tlrc --> Average volume of 452 normal brains.'
466+
' Skull Stripped. (www.loni.ucla.edu)'
467+
'TT_avg152T1+tlrc --> Average volume of 152 normal brains.'
468+
' Skull Stripped.(www.bic.mni.mcgill.ca)'
469+
'TT_EPI+tlrc --> EPI template from spm2, masked as TT_avg152T1'
470+
' TT_avg152 and TT_EPI volume sources are from'
471+
' SPM\'s distribution. (www.fil.ion.ucl.ac.uk/spm/)'
472+
'If you do not specify a path for the template, the script'
473+
'will attempt to locate the template AFNI\'s binaries directory.'
474+
'NOTE: These datasets have been slightly modified from'
475+
' their original size to match the standard TLRC'
476+
' dimensions (Jean Talairach and Pierre Tournoux'
477+
' Co-Planar Stereotaxic Atlas of the Human Brain'
478+
' Thieme Medical Publishers, New York, 1988). '
479+
' That was done for internal consistency in AFNI.'
480+
' You may use the original form of these'
481+
' volumes if you choose but your TLRC coordinates'
482+
' will not be consistent with AFNI\'s TLRC database'
483+
' (San Antonio Talairach Daemon database), for example.',
484+
mandatory = True,
485+
argstr='-base %s')
486+
no_ss = traits.Bool(
487+
desc='Do not strip skull of input data set'
488+
'(because skull has already been removed'
489+
'or because template still has the skull)'
490+
'NOTE: The -no_ss option is not all that optional.'
491+
' Here is a table of when you should and should not use -no_ss'
492+
' Template Template'
493+
' WITH skull WITHOUT skull'
494+
' Dset.'
495+
' WITH skull -no_ss xxx '
496+
' '
497+
' WITHOUT skull No Cigar -no_ss'
498+
' '
499+
' Template means: Your template of choice'
500+
' Dset. means: Your anatomical dataset'
501+
' -no_ss means: Skull stripping should not be attempted on Dset'
502+
' xxx means: Don\'t put anything, the script will strip Dset'
503+
' No Cigar means: Don\'t try that combination, it makes no sense.',
504+
argstr='-no_ss')
505+
506+
class AutoTLRC(AFNICommand):
507+
"""A minmal wrapper for the AutoTLRC script
508+
The only option currently supported is no_ss.
509+
For complete details, see the `3dQwarp Documentation.
510+
<https://afni.nimh.nih.gov/pub/dist/doc/program_help/@auto_tlrc.html>`_
435511
512+
Examples
513+
========
514+
>>> from nipype.interfaces import afni
515+
>>> autoTLRC = afni.AutoTLRC()
516+
>>> autoTLRC.inputs.in_file = 'structural.nii'
517+
>>> autoTLRC.inputs.no_ss = True
518+
>>> autoTLRC.inputs.base = "TT_N27+tlrc"
519+
>>> autoTLRC.cmdline # doctest: +ALLOW_UNICODE
520+
'@auto_tlrc -base TT_N27+tlrc -input structural.nii -no_ss'
521+
>>> res = autoTLRC.run() # doctest: +SKIP
522+
523+
"""
524+
_cmd = '@auto_tlrc'
525+
input_spec = AutoTLRCInputSpec
526+
output_spec = AFNICommandOutputSpec
527+
def _list_outputs(self):
528+
outputs = self.output_spec().get()
529+
ext = '.HEAD'
530+
outputs['out_file'] = os.path.abspath(self._gen_fname(self.inputs.in_file, suffix='+tlrc')+ext)
531+
return outputs
532+
436533
class BandpassInputSpec(AFNICommandInputSpec):
437534
in_file = File(
438535
desc='input file to 3dBandpass',

0 commit comments

Comments
 (0)