Skip to content

Commit

Permalink
ENH: Split SyN fieldmap estimates per-EPI
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Apr 20, 2023
1 parent a0ca7c3 commit 69f4407
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions sdcflows/utils/wrangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,28 +499,23 @@ def find_estimators(
meta.update({"TotalReadoutTime": ro})
epi_targets.append(fm.FieldmapFile(candidate.path, metadata=meta))

for pe_dir in sorted(set(pe_dirs)):
pe_ro = [ro for ro, pe in zip(ro_totals, pe_dirs) if pe == pe_dir]
for ro_time in sorted(set(pe_ro)):
fmfiles, fmpaths = tuple(
zip(
*[
(target, str(Path(target.path).relative_to(subject_root)))
for i, target in enumerate(epi_targets)
if pe_dirs[i] == pe_dir and ro_totals[i] == ro_time
]
)
)
e = fm.FieldmapEstimation(
[
fm.FieldmapFile(
anat_file[0], metadata={"IntendedFor": fmpaths}
),
*fmfiles,
]
)
_log_debug_estimation(logger, e, layout.root)
estimators.append(e)
trivial_estimators = [
[
fm.FieldmapFile(
anat_file[0],
metadata={"IntendedFor": str(Path(epi.path).relative_to(subject_root))},
),
epi,
] for epi in epi_targets
]

# TODO: Grouping could be done here; previously we grouped by (pe_dir, ro_time) pairs
syn_estimators = [fm.FieldmapEstimation(e) for e in trivial_estimators]

for e in syn_estimators:
_log_debug_estimation(logger, e, layout.root)

estimators.extend(syn_estimators)

return estimators

Expand Down

0 comments on commit 69f4407

Please sign in to comment.