Skip to content

Commit 47ac722

Browse files
authored
Add --me-t2s-fit-method parameter (#3030)
Closes #3029. ## Changes proposed in this pull request - Add a new command line parameter, `--me-t2s-fit-method`, to control how T2* and S0 will be estimated with tedana. The default, "curvefit", is slower and more memory intensive, which has led to out-of-memory errors for some users. The new option, "loglin", shouldn't result in the same memory issues, but it also may produce less accurate estimates. ## Documentation that should be reviewed I added a couple of sentences on the new parameter to the "T2*-driven echo combination" section of `workflows.rst`.
2 parents e6bda71 + 2f64c76 commit 47ac722

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

docs/workflows.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,12 @@ and optimally weighted combination of all supplied single echo time series.
598598
This optimally combined time series is then carried forward for all subsequent
599599
preprocessing steps.
600600

601+
The method by which T2* and S0 are estimated is determined by the ``--me-t2s-fit-method`` parameter.
602+
The default method is "curvefit", which uses nonlinear regression to estimate T2* and S0.
603+
The other option is "loglin", which uses log-linear regression.
604+
The "loglin" option is faster and less memory intensive,
605+
but it may be less accurate than "curvefit".
606+
601607
References
602608
----------
603609

fmriprep/cli/parser.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,19 @@ def _slice_time_ref(value, parser):
359359
default=None,
360360
help="Initialize the random seed for the workflow",
361361
)
362+
g_conf.add_argument(
363+
"--me-t2s-fit-method",
364+
action="store",
365+
default="curvefit",
366+
choices=["curvefit", "loglin"],
367+
help=(
368+
"The method by which to estimate T2* and S0 for multi-echo data. "
369+
"'curvefit' uses nonlinear regression. "
370+
"It is more memory intensive, but also may be more accurate, than 'loglin'. "
371+
"'loglin' uses log-linear regression. "
372+
"It is faster and less memory intensive, but may be less accurate."
373+
),
374+
)
362375

363376
g_outputs = parser.add_argument_group("Options for modulating outputs")
364377
g_outputs.add_argument(

fmriprep/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ class workflow(_Config):
571571
use_syn_sdc = None
572572
"""Run *fieldmap-less* susceptibility-derived distortions estimation
573573
in the absence of any alternatives."""
574+
me_t2s_fit_method = "curvefit"
575+
"""The method by which to estimate T2*/S0 for multi-echo data"""
574576

575577

576578
class loggers:

fmriprep/workflows/bold/t2s.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,19 @@ def init_bold_t2s_wf(
8989
from niworkflows.interfaces.morphology import BinaryDilation
9090

9191
workflow = Workflow(name=name)
92-
workflow.__desc__ = """\
92+
if config.workflow.me_t2s_fit_method == "curvefit":
93+
fit_str = (
94+
"nonlinear regression. "
95+
"The T2<sup>★</sup>/S<sub>0</sub> estimates from a log-linear regression fit "
96+
"were used for initial values"
97+
)
98+
else:
99+
fit_str = "log-linear regression"
100+
101+
workflow.__desc__ = f"""\
93102
A T2<sup>★</sup> map was estimated from the preprocessed EPI echoes, by voxel-wise fitting
94103
the maximal number of echoes with reliable signal in that voxel to a monoexponential signal
95-
decay model with nonlinear regression.
96-
The T2<sup>★</sup>/S<sub>0</sub> estimates from a log-linear regression fit were used for
97-
initial values.
104+
decay model with {fit_str}.
98105
The calculated T2<sup>★</sup> map was then used to optimally combine preprocessed BOLD across
99106
echoes following the method described in [@posse_t2s].
100107
The optimally combined time series was carried forward as the *preprocessed BOLD*.
@@ -109,7 +116,7 @@ def init_bold_t2s_wf(
109116
dilate_mask = pe.Node(BinaryDilation(radius=2), name='dilate_mask')
110117

111118
t2smap_node = pe.Node(
112-
T2SMap(echo_times=list(echo_times)),
119+
T2SMap(echo_times=list(echo_times), fittype=config.workflow.me_t2s_fit_method),
113120
name='t2smap_node',
114121
mem_gb=2.5 * mem_gb * len(echo_times),
115122
)

0 commit comments

Comments
 (0)