@@ -2637,31 +2637,58 @@ class TShift(AFNICommand):
2637
2637
Examples
2638
2638
========
2639
2639
2640
+ Slice timing details may be specified explicitly via the ``slice_timing``
2641
+ input:
2642
+
2640
2643
>>> from nipype.interfaces import afni
2644
+ >>> TR = 2.5
2641
2645
>>> tshift = afni.TShift()
2642
2646
>>> tshift.inputs.in_file = 'functional.nii'
2643
- >>> tshift.inputs.tpattern = 'alt+z'
2644
2647
>>> tshift.inputs.tzero = 0.0
2648
+ >>> tshift.inputs.tr = '%.1fs' % TR
2649
+ >>> tshift.inputs.slice_timing = list(np.arange(40) / TR)
2645
2650
>>> 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'
2648
2652
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:
2650
2655
2651
- >>> TR = 2.5
2652
2656
>>> tshift = afni.TShift()
2653
2657
>>> tshift.inputs.in_file = 'functional.nii'
2654
2658
>>> tshift.inputs.tzero = 0.0
2655
2659
>>> tshift.inputs.tr = '%.1fs' % TR
2656
- >>> tshift.inputs.slice_timing = list(np.arange(40) / TR)
2660
+ >>> tshift.inputs.slice_timing = 'slice_timing.1D'
2657
2661
>>> tshift.cmdline
2658
2662
'3dTshift -prefix functional_tshift -tpattern @slice_timing.1D -TR 2.5s -tzero 0.0 functional.nii'
2659
2663
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:
2662
2667
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:
2664
2690
2691
+ >>> res = tshift.run() # doctest: +SKIP
2665
2692
"""
2666
2693
_cmd = '3dTshift'
2667
2694
input_spec = TShiftInputSpec
0 commit comments