Skip to content

Commit 7512be3

Browse files
committed
DOC: Improve documentation to delineate all options
1 parent 4265da3 commit 7512be3

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

nipype/interfaces/afni/preprocess.py

+36-9
Original file line numberDiff line numberDiff line change
@@ -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

nipype/testing/data/slice_timing.1D

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6 4.0 4.4 4.8 5.2 5.6 6.0 6.4 6.8 7.2 7.6 8.0 8.4 8.8 9.2 9.6 10.0 10.4 10.8 11.2 11.6 12.0 12.4 12.8 13.2 13.6 14.0 14.4 14.8 15.2 15.6

0 commit comments

Comments
 (0)