Skip to content

Commit fc91066

Browse files
committed
feat: Add workflow arguments for metadata estimates and fallback TRT
1 parent 3828bf0 commit fc91066

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

sdcflows/workflows/apply/correction.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
def init_unwarp_wf(
3030
*,
3131
jacobian=True,
32+
use_metadata_estimates=False,
33+
fallback_total_readout_time=None,
3234
free_mem=None,
3335
omp_nthreads=1,
3436
debug=False,
@@ -117,8 +119,16 @@ def init_unwarp_wf(
117119
name="outputnode",
118120
)
119121

120-
rotime = pe.Node(GetReadoutTime(), name="rotime")
122+
rotime = pe.Node(
123+
GetReadoutTime(
124+
use_estimate=use_metadata_estimates,
125+
),
126+
name="rotime",
127+
run_without_submitting=True,
128+
)
121129
rotime.interface._always_run = debug
130+
if fallback_total_readout_time is not None:
131+
rotime.inputs.fallback = fallback_total_readout_time
122132

123133
# resample is memory-hungry; choose a smaller number of threads
124134
# if we know how much memory we have to work with

sdcflows/workflows/fit/pepolar.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
def init_topup_wf(
3838
grid_reference=0,
39+
use_metadata_estimates=False,
40+
fallback_total_readout_time=None,
3941
omp_nthreads=1,
4042
sloppy=False,
4143
debug=False,
@@ -122,11 +124,15 @@ def init_topup_wf(
122124

123125
# Calculate the total readout time of each run
124126
readout_time = pe.MapNode(
125-
GetReadoutTime(),
127+
GetReadoutTime(
128+
use_estimate=use_metadata_estimates,
129+
),
126130
name="readout_time",
127131
iterfield=["metadata", "in_file"],
128132
run_without_submitting=True,
129133
)
134+
if fallback_total_readout_time is not None:
135+
readout_time.inputs.fallback = fallback_total_readout_time
130136
# Average each run so that topup is not overwhelmed (see #279)
131137
runwise_avg = pe.MapNode(
132138
RobustAverage(num_threads=omp_nthreads),

sdcflows/workflows/fit/syn.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
def init_syn_sdc_wf(
4343
*,
4444
atlas_threshold=3,
45+
use_metadata_estimates=False,
46+
fallback_total_readout_time=None,
4547
sloppy=False,
4648
debug=False,
4749
name="syn_sdc_wf",
@@ -160,10 +162,14 @@ def init_syn_sdc_wf(
160162
outputnode.inputs.method = 'FLB ("fieldmap-less", SyN-based)'
161163

162164
readout_time = pe.Node(
163-
GetReadoutTime(),
165+
GetReadoutTime(
166+
use_estimate=use_metadata_estimates,
167+
),
164168
name="readout_time",
165169
run_without_submitting=True,
166170
)
171+
if fallback_total_readout_time is not None:
172+
readout_time.inputs.fallback = fallback_total_readout_time
167173

168174
warp_dir = pe.Node(
169175
niu.Function(function=_warp_dir),

0 commit comments

Comments
 (0)