Skip to content

Commit dc65095

Browse files
committed
Ignore non-steady-state volumes in T2* estimation.
1 parent 2cedf76 commit dc65095

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

fmriprep/interfaces/multiecho.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ class T2SMapInputSpec(CommandLineInputSpec):
6868
'monoexponential model is fit to the raw data.'
6969
),
7070
)
71+
n_exclude = traits.Int(
72+
argstr='--exclude %s',
73+
position=5,
74+
desc='Number of volumes from the beginning of the run to exclude from T2*/S0 estimation.',
75+
)
7176

7277

7378
class T2SMapOutputSpec(TraitedSpec):
@@ -103,6 +108,9 @@ class T2SMap(CommandLine):
103108
def _format_arg(self, name, trait_spec, value):
104109
if name == 'echo_times':
105110
value = [te * 1000 for te in value]
111+
if name == 'n_exclude':
112+
# Convert to a range
113+
value = f'0:{value}'
106114
return super()._format_arg(name, trait_spec, value)
107115

108116
def _list_outputs(self):

fmriprep/workflows/bold/fit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,10 @@ def init_bold_native_wf(
981981
# Do NOT set motion_xfm on outputnode
982982
# This prevents downstream resamplers from double-dipping
983983
workflow.connect([
984-
(inputnode, bold_t2s_wf, [('bold_mask', 'inputnode.bold_mask')]),
984+
(inputnode, bold_t2s_wf, [
985+
('bold_mask', 'inputnode.bold_mask'),
986+
('dummy_scans', 'inputnode.skip_vols'),
987+
]),
985988
(boldref_bold, join_echos, [('out_file', 'bold_files')]),
986989
(join_echos, bold_t2s_wf, [('bold_files', 'inputnode.bold_file')]),
987990
(join_echos, outputnode, [('bold_files', 'bold_echos')]),

fmriprep/workflows/bold/t2s.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ def init_bold_t2s_wf(
107107
The optimally combined time series was carried forward as the *preprocessed BOLD*.
108108
"""
109109

110-
inputnode = pe.Node(niu.IdentityInterface(fields=['bold_file', 'bold_mask']), name='inputnode')
110+
inputnode = pe.Node(
111+
niu.IdentityInterface(fields=['bold_file', 'bold_mask', 'skip_vols']),
112+
name='inputnode',
113+
)
111114

112115
outputnode = pe.Node(niu.IdentityInterface(fields=['bold', 't2star_map']), name='outputnode')
113116

@@ -122,7 +125,10 @@ def init_bold_t2s_wf(
122125
)
123126
workflow.connect([
124127
(inputnode, dilate_mask, [('bold_mask', 'in_mask')]),
125-
(inputnode, t2smap_node, [('bold_file', 'in_files')]),
128+
(inputnode, t2smap_node, [
129+
('bold_file', 'in_files'),
130+
('skip_vols', 'n_exclude'),
131+
]),
126132
(dilate_mask, t2smap_node, [('out_mask', 'mask_file')]),
127133
(t2smap_node, outputnode, [('optimal_comb', 'bold'),
128134
('t2star_map', 't2star_map')]),

0 commit comments

Comments
 (0)