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