Skip to content

Commit 78b9c66

Browse files
committed
RF: Use TShift.inputs.slice_timing
1 parent 400c599 commit 78b9c66

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

fmriprep/workflows/bold/stc.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,35 +59,18 @@ def init_bold_stc_wf(metadata, name='bold_stc_wf'):
5959

6060
LOGGER.log(25, 'Slice-timing correction will be included.')
6161

62-
def create_custom_slice_timing_file_func(metadata):
63-
import os
64-
slice_timings_sec = ["%f" % t for t in metadata["SliceTiming"]]
65-
out_file = os.path.abspath("timings.1D")
66-
with open(out_file, "w") as fp:
67-
fp.write("\t".join(slice_timings_sec))
68-
return out_file
69-
70-
create_custom_slice_timing_file = pe.Node(
71-
niu.Function(function=create_custom_slice_timing_file_func),
72-
name="create_custom_slice_timing_file",
73-
mem_gb=DEFAULT_MEMORY_MIN_GB)
74-
create_custom_slice_timing_file.inputs.metadata = metadata
75-
7662
# It would be good to fingerprint memory use of afni.TShift
7763
slice_timing_correction = pe.Node(
78-
afni.TShift(outputtype='NIFTI_GZ', tr='{}s'.format(metadata["RepetitionTime"])),
64+
afni.TShift(outputtype='NIFTI_GZ',
65+
tr='{}s'.format(metadata["RepetitionTime"]),
66+
slice_timing=metadata['SliceTiming']),
7967
name='slice_timing_correction')
8068

8169
copy_xform = pe.Node(CopyXForm(), name='copy_xform', mem_gb=0.1)
8270

83-
def _prefix_at(x):
84-
return "@%s" % x
85-
8671
workflow.connect([
8772
(inputnode, slice_timing_correction, [('bold_file', 'in_file'),
8873
('skip_vols', 'ignore')]),
89-
(create_custom_slice_timing_file, slice_timing_correction, [
90-
(('out', _prefix_at), 'tpattern')]),
9174
(slice_timing_correction, copy_xform, [('out_file', 'in_file')]),
9275
(inputnode, copy_xform, [('bold_file', 'hdr_file')]),
9376
(copy_xform, outputnode, [('out_file', 'stc_file')]),

0 commit comments

Comments
 (0)