Skip to content

Commit cdbb425

Browse files
authored
Merge pull request #1160 from effigies/rf/upstream_tshift
[ENH] Use upstream TShift improvements
2 parents 65078c9 + bbcb008 commit cdbb425

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

docs/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies:
2121
- python-dateutil
2222
- pydot>=1.2.3
2323
- cython
24-
- nipype>=1.1.0
24+
- nipype>=1.1.1
2525

2626
- pip:
2727
- sphinx-argparse

fmriprep/workflows/bold/stc.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,20 @@ def init_bold_stc_wf(metadata, name='bold_stc_wf'):
6363
inputnode = pe.Node(niu.IdentityInterface(fields=['bold_file', 'skip_vols']), name='inputnode')
6464
outputnode = pe.Node(niu.IdentityInterface(fields=['stc_file']), name='outputnode')
6565

66-
def create_custom_slice_timing_file_func(metadata):
67-
import os
68-
slice_timings_sec = ["%f" % t for t in metadata["SliceTiming"]]
69-
out_file = os.path.abspath("timings.1D")
70-
with open(out_file, "w") as fp:
71-
fp.write("\t".join(slice_timings_sec))
72-
return out_file
73-
74-
create_custom_slice_timing_file = pe.Node(
75-
niu.Function(function=create_custom_slice_timing_file_func),
76-
name="create_custom_slice_timing_file",
77-
mem_gb=DEFAULT_MEMORY_MIN_GB)
78-
create_custom_slice_timing_file.inputs.metadata = metadata
66+
LOGGER.log(25, 'Slice-timing correction will be included.')
7967

8068
# It would be good to fingerprint memory use of afni.TShift
8169
slice_timing_correction = pe.Node(
82-
afni.TShift(outputtype='NIFTI_GZ', tr='{}s'.format(metadata["RepetitionTime"])),
70+
afni.TShift(outputtype='NIFTI_GZ',
71+
tr='{}s'.format(metadata["RepetitionTime"]),
72+
slice_timing=metadata['SliceTiming']),
8373
name='slice_timing_correction')
8474

8575
copy_xform = pe.Node(CopyXForm(), name='copy_xform', mem_gb=0.1)
8676

87-
def _prefix_at(x):
88-
return "@%s" % x
89-
9077
workflow.connect([
9178
(inputnode, slice_timing_correction, [('bold_file', 'in_file'),
9279
('skip_vols', 'ignore')]),
93-
(create_custom_slice_timing_file, slice_timing_correction, [
94-
(('out', _prefix_at), 'tpattern')]),
9580
(slice_timing_correction, copy_xform, [('out_file', 'in_file')]),
9681
(inputnode, copy_xform, [('bold_file', 'hdr_file')]),
9782
(copy_xform, outputnode, [('out_file', 'stc_file')]),

0 commit comments

Comments
 (0)