Skip to content

Commit b28d1d9

Browse files
authored
Merge pull request #385 from mgxd/fix/me-fittype
FIX: Add missing me-t2s-fit-method option
2 parents 93632f7 + 34ddab8 commit b28d1d9

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

nibabies/cli/parser.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,19 @@ def _slice_time_ref(value, parser):
456456
default=None,
457457
help='Initialize the random seed for the workflow',
458458
)
459+
g_conf.add_argument(
460+
'--me-t2s-fit-method',
461+
action='store',
462+
default='curvefit',
463+
choices=['curvefit', 'loglin'],
464+
help=(
465+
'The method by which to estimate T2* and S0 for multi-echo data. '
466+
"'curvefit' uses nonlinear regression. "
467+
"It is more memory intensive, but also may be more accurate, than 'loglin'. "
468+
"'loglin' uses log-linear regression. "
469+
'It is faster and less memory intensive, but may be less accurate.'
470+
),
471+
)
459472

460473
# Confounds options
461474
g_confounds = parser.add_argument_group('Specific options for estimating confounds')

nibabies/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ class workflow(_Config):
630630
use_syn_sdc = None
631631
"""Run *fieldmap-less* susceptibility-derived distortions estimation
632632
in the absence of any alternatives."""
633+
me_t2s_fit_method = 'curvefit'
634+
"""The method by which to estimate T2*/S0 for multi-echo data"""
633635

634636

635637
class loggers:

nibabies/workflows/bold/fit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ def init_bold_native_wf(
882882
echo_times=echo_times,
883883
mem_gb=mem_gb['filesize'],
884884
omp_nthreads=config.nipype.omp_nthreads,
885+
me_t2s_fit_method=config.workflow.me_t2s_fit_method,
885886
name='bold_t2smap_wf',
886887
)
887888

nibabies/workflows/bold/t2s.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def init_bold_t2s_wf(
4646
echo_times: ty.Sequence[float],
4747
mem_gb: float,
4848
omp_nthreads: int,
49+
me_t2s_fit_method: ty.Literal['curvefit', 'loglin'] = 'curvefit',
4950
name: str = 'bold_t2s_wf',
5051
):
5152
r"""
@@ -89,14 +90,16 @@ def init_bold_t2s_wf(
8990
from niworkflows.interfaces.morphology import BinaryDilation
9091

9192
workflow = Workflow(name=name)
92-
if config.workflow.me_t2s_fit_method == 'curvefit':
93+
if me_t2s_fit_method == 'curvefit':
9394
fit_str = (
9495
'nonlinear regression. '
9596
'The T2<sup>★</sup>/S<sub>0</sub> estimates from a log-linear regression fit '
9697
'were used for initial values'
9798
)
98-
else:
99+
elif me_t2s_fit_method == 'loglin':
99100
fit_str = 'log-linear regression'
101+
else:
102+
fit_str = f'unknown method: {me_t2s_fit_method}'
100103

101104
workflow.__desc__ = f"""\
102105
A T2<sup>★</sup> map was estimated from the preprocessed EPI echoes, by voxel-wise fitting
@@ -116,7 +119,7 @@ def init_bold_t2s_wf(
116119
dilate_mask = pe.Node(BinaryDilation(radius=2), name='dilate_mask')
117120

118121
t2smap_node = pe.Node(
119-
T2SMap(echo_times=list(echo_times), fittype=config.workflow.me_t2s_fit_method),
122+
T2SMap(echo_times=list(echo_times), fittype=me_t2s_fit_method),
120123
name='t2smap_node',
121124
mem_gb=2.5 * mem_gb * len(echo_times),
122125
)

0 commit comments

Comments
 (0)