Skip to content

Commit 9162cb9

Browse files
committed
DOC: Improve documentation to delineate all options
1 parent 6bfda6e commit 9162cb9

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
@@ -2632,31 +2632,58 @@ class TShift(AFNICommand):
26322632
Examples
26332633
========
26342634
2635+
Slice timing details may be specified explicitly via the ``slice_timing``
2636+
input:
2637+
26352638
>>> from nipype.interfaces import afni
2639+
>>> TR = 2.5
26362640
>>> tshift = afni.TShift()
26372641
>>> tshift.inputs.in_file = 'functional.nii'
2638-
>>> tshift.inputs.tpattern = 'alt+z'
26392642
>>> tshift.inputs.tzero = 0.0
2643+
>>> tshift.inputs.tr = '%.1fs' % TR
2644+
>>> tshift.inputs.slice_timing = list(np.arange(40) / TR)
26402645
>>> 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'
26432647
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:
26452650
2646-
>>> TR = 2.5
26472651
>>> tshift = afni.TShift()
26482652
>>> tshift.inputs.in_file = 'functional.nii'
26492653
>>> tshift.inputs.tzero = 0.0
26502654
>>> tshift.inputs.tr = '%.1fs' % TR
2651-
>>> tshift.inputs.slice_timing = list(np.arange(40) / TR)
2655+
>>> tshift.inputs.slice_timing = 'slice_timing.1D'
26522656
>>> tshift.cmdline
26532657
'3dTshift -prefix functional_tshift -tpattern @slice_timing.1D -TR 2.5s -tzero 0.0 functional.nii'
26542658
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:
26572662
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:
26592685
2686+
>>> res = tshift.run() # doctest: +SKIP
26602687
"""
26612688
_cmd = '3dTshift'
26622689
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)