@@ -2627,6 +2627,10 @@ class TShiftInputSpec(AFNICommandInputSpec):
2627
2627
argstr = '-rlt+' )
2628
2628
2629
2629
2630
+ class TShiftOutputSpec (AFNICommandOutputSpec ):
2631
+ timing_file = File (desc = "AFNI formatted timing file, if ``slice_timing`` is a list" )
2632
+
2633
+
2630
2634
class TShift (AFNICommand ):
2631
2635
"""Shifts voxel time series from input so that seperate slices are aligned
2632
2636
to the same temporal origin.
@@ -2650,6 +2654,12 @@ class TShift(AFNICommand):
2650
2654
>>> tshift.cmdline
2651
2655
'3dTshift -prefix functional_tshift -tpattern @slice_timing.1D -TR 2.5s -tzero 0.0 functional.nii'
2652
2656
2657
+ When the ``slice_timing`` input is used, the ``timing_file`` output is populated,
2658
+ in this case with the generated file.
2659
+
2660
+ >>> tshift._list_outputs()['timing_file'] # doctest: +ELLIPSIS
2661
+ '.../slice_timing.1D'
2662
+
2653
2663
This method creates a ``slice_timing.1D`` file to be passed to ``3dTshift``.
2654
2664
A pre-existing slice-timing file may be used in the same way:
2655
2665
@@ -2661,6 +2671,11 @@ class TShift(AFNICommand):
2661
2671
>>> tshift.cmdline
2662
2672
'3dTshift -prefix functional_tshift -tpattern @slice_timing.1D -TR 2.5s -tzero 0.0 functional.nii'
2663
2673
2674
+ When a pre-existing file is provided, ``timing_file`` is simply passed through.
2675
+
2676
+ >>> tshift._list_outputs()['timing_file'] # doctest: +ELLIPSIS
2677
+ '.../slice_timing.1D'
2678
+
2664
2679
Alternatively, pre-specified slice timing patterns may be specified with the
2665
2680
``tpattern`` input.
2666
2681
For example, to specify an alternating, ascending slice timing pattern:
@@ -2686,13 +2701,18 @@ class TShift(AFNICommand):
2686
2701
>>> tshift.cmdline
2687
2702
'3dTshift -prefix functional_tshift -tpattern @slice_timing.1D -TR 2.5s -tzero 0.0 functional.nii'
2688
2703
2704
+ In these cases, ``timing_file`` is undefined.
2705
+
2706
+ >>> tshift._list_outputs()['timing_file'] # doctest: +ELLIPSIS
2707
+ <undefined>
2708
+
2689
2709
In any configuration, the interface may be run as usual:
2690
2710
2691
2711
>>> res = tshift.run() # doctest: +SKIP
2692
2712
"""
2693
2713
_cmd = '3dTshift'
2694
2714
input_spec = TShiftInputSpec
2695
- output_spec = AFNICommandOutputSpec
2715
+ output_spec = TShiftOutputSpec
2696
2716
2697
2717
def _format_arg (self , name , trait_spec , value ):
2698
2718
if name == 'tpattern' and value .startswith ('@' ):
@@ -2708,6 +2728,15 @@ def _write_slice_timing(self):
2708
2728
fobj .write ('\t ' .join (map (str , self .inputs .slice_timing )))
2709
2729
return fname
2710
2730
2731
+ def _list_outputs (self ):
2732
+ outputs = super (TShift , self )._list_outputs ()
2733
+ if isdefined (self .inputs .slice_timing ):
2734
+ if isinstance (self .inputs .slice_timing , list ):
2735
+ outputs ['timing_file' ] = os .path .abspath ('slice_timing.1D' )
2736
+ else :
2737
+ outputs ['timing_file' ] = os .path .abspath (self .inputs .slice_timing )
2738
+ return outputs
2739
+
2711
2740
2712
2741
class VolregInputSpec (AFNICommandInputSpec ):
2713
2742
in_file = File (
0 commit comments