@@ -2637,31 +2637,58 @@ class TShift(AFNICommand):
26372637 Examples
26382638 ========
26392639
2640+ Slice timing details may be specified explicitly via the ``slice_timing``
2641+ input:
2642+
26402643 >>> from nipype.interfaces import afni
2644+ >>> TR = 2.5
26412645 >>> tshift = afni.TShift()
26422646 >>> tshift.inputs.in_file = 'functional.nii'
2643- >>> tshift.inputs.tpattern = 'alt+z'
26442647 >>> tshift.inputs.tzero = 0.0
2648+ >>> tshift.inputs.tr = '%.1fs' % TR
2649+ >>> tshift.inputs.slice_timing = list(np.arange(40) / TR)
26452650 >>> tshift.cmdline
2646- '3dTshift -prefix functional_tshift -tpattern alt+z -tzero 0.0 functional.nii'
2647- >>> res = tshift.run() # doctest: +SKIP
2651+ '3dTshift -prefix functional_tshift -tpattern @slice_timing.1D -TR 2.5s -tzero 0.0 functional.nii'
26482652
2649- Slice timings may be explicitly specified:
2653+ This method creates a ``slice_timing.1D`` file to be passed to ``3dTshift``.
2654+ A pre-existing slice-timing file may be used in the same way:
26502655
2651- >>> TR = 2.5
26522656 >>> tshift = afni.TShift()
26532657 >>> tshift.inputs.in_file = 'functional.nii'
26542658 >>> tshift.inputs.tzero = 0.0
26552659 >>> tshift.inputs.tr = '%.1fs' % TR
2656- >>> tshift.inputs.slice_timing = list(np.arange(40) / TR)
2660+ >>> tshift.inputs.slice_timing = 'slice_timing.1D'
26572661 >>> tshift.cmdline
26582662 '3dTshift -prefix functional_tshift -tpattern @slice_timing.1D -TR 2.5s -tzero 0.0 functional.nii'
26592663
2660- This will create the ``slice_timing.1D`` file in the working directory.
2661- You may wish to remove this after running:
2664+ Alternatively, pre-specified slice timing patterns may be specified with the
2665+ ``tpattern`` input.
2666+ For example, to specify an alternating, ascending slice timing pattern:
26622667
2663- >>> os.unlink('slice_timing.1D')
2668+ >>> tshift = afni.TShift()
2669+ >>> tshift.inputs.in_file = 'functional.nii'
2670+ >>> tshift.inputs.tzero = 0.0
2671+ >>> tshift.inputs.tr = '%.1fs' % TR
2672+ >>> tshift.inputs.tpattern = 'alt+z'
2673+ >>> tshift.cmdline
2674+ '3dTshift -prefix functional_tshift -tpattern alt+z -TR 2.5s -tzero 0.0 functional.nii'
2675+
2676+ For backwards compatibility, ``tpattern`` may also take filenames prefixed
2677+ with ``@``.
2678+ However, in this case, filenames are not validated, so this usage will be
2679+ deprecated in future versions of Nipype.
2680+
2681+ >>> tshift = afni.TShift()
2682+ >>> tshift.inputs.in_file = 'functional.nii'
2683+ >>> tshift.inputs.tzero = 0.0
2684+ >>> tshift.inputs.tr = '%.1fs' % TR
2685+ >>> tshift.inputs.tpattern = '@slice_timing.1D'
2686+ >>> tshift.cmdline
2687+ '3dTshift -prefix functional_tshift -tpattern @slice_timing.1D -TR 2.5s -tzero 0.0 functional.nii'
2688+
2689+ In any configuration, the interface may be run as usual:
26642690
2691+ >>> res = tshift.run() # doctest: +SKIP
26652692 """
26662693 _cmd = '3dTshift'
26672694 input_spec = TShiftInputSpec
0 commit comments