Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

 [FIX] force_fmapless on top of self-correcting pepolar bold #465

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions sdcflows/utils/tests/test_wrangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,15 @@ def test_wrangler_filter(tmpdir, name, skeleton, estimations):
('phasediff', phasediff, 3),
],
)
@pytest.mark.parametrize("session, estimations", [
("01", 1),
("02", 1),
("03", 1),
(None, None),
])
@pytest.mark.parametrize(
"session, estimations",
[
("01", 1),
("02", 1),
("03", 1),
(None, None),
],
)
def test_wrangler_URIs(tmpdir, name, skeleton, session, estimations, total_estimations):
bids_dir = str(tmpdir / name)
generate_bids_skeleton(bids_dir, skeleton)
Expand Down Expand Up @@ -472,3 +475,32 @@ def test_fieldmapless(tmp_path):
assert len(est[0].sources) == 2
clear_registry()
rmtree(bids_dir)

# force fmapless on top of self-pepolar
self_pepolar_metadata = {
**bold["metadata"],
"B0FieldIdentifier": "pepolar_fmap",
"B0FieldSource": "pepolar_fmap",
}

spec = {
"01": {
"anat": [T1w],
"func": [
{
"run": i,
**bold,
"metadata": {**self_pepolar_metadata, "PhaseEncodingDirection": pedir},
}
for i, pedir in zip(range(1, 3), ["j", "j-"])
],
},
}
generate_bids_skeleton(bids_dir, spec)
layout = gen_layout(bids_dir)
ests = find_estimators(layout=layout, subject="01", fmapless=True, force_fmapless=True)
assert len(ests) == 3
for est in ests:
assert len(est.sources) == 2
clear_registry()
rmtree(bids_dir)
4 changes: 2 additions & 2 deletions sdcflows/utils/wrangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,9 @@ def find_estimators(
base_entities=base_entities,
suffixes=fmapless,
)
for spec in estimator_specs:
for si, spec in enumerate(estimator_specs):
try:
estimator = fm.FieldmapEstimation(spec)
estimator = fm.FieldmapEstimation(spec, bids_id=f"auto_fmapless_{si}")
except (ValueError, TypeError) as err:
_log_debug_estimator_fail(logger, "ANAT", spec, layout.root, str(err))
else:
Expand Down
Loading