Skip to content

Commit 69f4407

Browse files
committed
ENH: Split SyN fieldmap estimates per-EPI
1 parent a0ca7c3 commit 69f4407

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

sdcflows/utils/wrangler.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -499,28 +499,23 @@ def find_estimators(
499499
meta.update({"TotalReadoutTime": ro})
500500
epi_targets.append(fm.FieldmapFile(candidate.path, metadata=meta))
501501

502-
for pe_dir in sorted(set(pe_dirs)):
503-
pe_ro = [ro for ro, pe in zip(ro_totals, pe_dirs) if pe == pe_dir]
504-
for ro_time in sorted(set(pe_ro)):
505-
fmfiles, fmpaths = tuple(
506-
zip(
507-
*[
508-
(target, str(Path(target.path).relative_to(subject_root)))
509-
for i, target in enumerate(epi_targets)
510-
if pe_dirs[i] == pe_dir and ro_totals[i] == ro_time
511-
]
512-
)
513-
)
514-
e = fm.FieldmapEstimation(
515-
[
516-
fm.FieldmapFile(
517-
anat_file[0], metadata={"IntendedFor": fmpaths}
518-
),
519-
*fmfiles,
520-
]
521-
)
522-
_log_debug_estimation(logger, e, layout.root)
523-
estimators.append(e)
502+
trivial_estimators = [
503+
[
504+
fm.FieldmapFile(
505+
anat_file[0],
506+
metadata={"IntendedFor": str(Path(epi.path).relative_to(subject_root))},
507+
),
508+
epi,
509+
] for epi in epi_targets
510+
]
511+
512+
# TODO: Grouping could be done here; previously we grouped by (pe_dir, ro_time) pairs
513+
syn_estimators = [fm.FieldmapEstimation(e) for e in trivial_estimators]
514+
515+
for e in syn_estimators:
516+
_log_debug_estimation(logger, e, layout.root)
517+
518+
estimators.extend(syn_estimators)
524519

525520
return estimators
526521

0 commit comments

Comments
 (0)