From fa3297c117b7dde45fccfc25f74580358e0ce91b Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Thu, 8 Jun 2023 13:40:28 -0400 Subject: [PATCH 1/3] Add --me-t2s-fit-method parameter. --- fmriprep/cli/parser.py | 13 +++++++++++++ fmriprep/config.py | 2 ++ fmriprep/workflows/bold/t2s.py | 17 ++++++++++++----- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/fmriprep/cli/parser.py b/fmriprep/cli/parser.py index 433836bbc..215dc77c4 100644 --- a/fmriprep/cli/parser.py +++ b/fmriprep/cli/parser.py @@ -359,6 +359,19 @@ def _slice_time_ref(value, parser): default=None, help="Initialize the random seed for the workflow", ) + g_conf.add_argument( + "--me-t2s-fit-method", + action="store", + default="curvefit", + choices=["curvefit", "loglin"], + help=( + "The method by which to estimate T2* and S0 for multi-echo data. " + "'curvefit' uses nonlinear regression. " + "It is more memory intensive, but also may be more accurate, than 'loglin'. " + "'loglin' uses log-linear regression. " + "It is faster and less memory intensive, but may be less accurate." + ), + ) g_outputs = parser.add_argument_group("Options for modulating outputs") g_outputs.add_argument( diff --git a/fmriprep/config.py b/fmriprep/config.py index d384250c6..fac24856c 100644 --- a/fmriprep/config.py +++ b/fmriprep/config.py @@ -571,6 +571,8 @@ class workflow(_Config): use_syn_sdc = None """Run *fieldmap-less* susceptibility-derived distortions estimation in the absence of any alternatives.""" + me_t2s_fit_method = "curvefit" + """The method by which to estimate T2*/S0 for multi-echo data""" class loggers: diff --git a/fmriprep/workflows/bold/t2s.py b/fmriprep/workflows/bold/t2s.py index 2d3a26053..f0b087716 100644 --- a/fmriprep/workflows/bold/t2s.py +++ b/fmriprep/workflows/bold/t2s.py @@ -89,12 +89,19 @@ def init_bold_t2s_wf( from niworkflows.interfaces.morphology import BinaryDilation workflow = Workflow(name=name) - workflow.__desc__ = """\ + if config.workflow.me_t2s_fit_method == "curvefit": + fit_str = ( + "nonlinear regression. " + "The T2/S0 estimates from a log-linear regression fit " + "were used for initial values" + ) + else: + fit_str = "log-linear regression" + + workflow.__desc__ = f"""\ A T2 map was estimated from the preprocessed EPI echoes, by voxel-wise fitting the maximal number of echoes with reliable signal in that voxel to a monoexponential signal -decay model with nonlinear regression. -The T2/S0 estimates from a log-linear regression fit were used for -initial values. +decay model with {fit_str}. The calculated T2 map was then used to optimally combine preprocessed BOLD across echoes following the method described in [@posse_t2s]. The optimally combined time series was carried forward as the *preprocessed BOLD*. @@ -109,7 +116,7 @@ def init_bold_t2s_wf( dilate_mask = pe.Node(BinaryDilation(radius=2), name='dilate_mask') t2smap_node = pe.Node( - T2SMap(echo_times=list(echo_times)), + T2SMap(echo_times=list(echo_times), fittype=config.workflow.me_t2s_fit_method), name='t2smap_node', mem_gb=2.5 * mem_gb * len(echo_times), ) From f641440104351c9bfc3558ce0e4fb26f255ed491 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Thu, 8 Jun 2023 13:44:43 -0400 Subject: [PATCH 2/3] Document the new option a bit. --- docs/workflows.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/workflows.rst b/docs/workflows.rst index 35e2e616c..04757cbb6 100644 --- a/docs/workflows.rst +++ b/docs/workflows.rst @@ -598,6 +598,12 @@ and optimally weighted combination of all supplied single echo time series. This optimally combined time series is then carried forward for all subsequent preprocessing steps. +The method by which T2* and S0 are estimated is determined by the ``--me-t2s-fit-method`` parameter. +The default method is "curvefit", which uses nonlinear regression to estimate T2* and S0. +The other option is "loglin", which uses log-linear regression. +The "loglin" option is faster and less memory intensive, +but it may be less accurate than "curvefit". + References ---------- From 2f64c76536d310579aeae3108d2b713cf3069147 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 8 Jun 2023 15:43:32 -0400 Subject: [PATCH 3/3] noop