Skip to content

Commit

Permalink
Try @effigies' recommendation.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Oct 4, 2024
1 parent d2569da commit b535b5f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions sdcflows/utils/wrangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,39 @@ def find_estimators(
_log_debug_estimation(logger, e, layout.root)
estimators.append(e)

medic_entities = {**base_entities, **{'part': 'mag', 'echo': Query.ANY}}
has_magnitude = tuple()
with suppress(ValueError):
has_magnitude = layout.get(
suffix='bold',
**medic_entities,
)

for mag_img in has_magnitude:
phase_img = layout.get(**{**mag_img.get_entities(), **{'part': 'phase'}})
if not phase_img:
continue

phase_img = phase_img[0]
try:
e = fm.FieldmapEstimation(
[
fm.FieldmapFile(mag_img.path, metadata=mag_img.get_metadata()),
fm.FieldmapFile(phase_img.path, metadata=phase_img.get_metadata()),
]
)
except (ValueError, TypeError) as err:
_log_debug_estimator_fail(
logger,
"potential MEDIC fieldmap",
[mag_img, phase_img],
layout.root,
str(err),
)
else:
_log_debug_estimation(logger, e, layout.root)
estimators.append(e)

if estimators and not force_fmapless:
fmapless = False

Expand Down

0 comments on commit b535b5f

Please sign in to comment.