Skip to content

Commit

Permalink
Fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Oct 31, 2024
1 parent e5bed21 commit 9ed06b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion xcp_d/tests/test_utils_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,16 @@ def test_collect_mesh_data(datasets, tmp_path_factory):
(std_mesh_dir / "sub-1648798153/ses-PNC1/anat").joinpath(f).touch()

layout = BIDSLayout(std_mesh_dir, validate=False)
mesh_available, standard_space_mesh, _, _ = xbids.collect_mesh_data(
mesh_available, standard_space_mesh, _, mesh_files = xbids.collect_mesh_data(
layout, "1648798153", bids_filters={}
)
assert mesh_available is True
assert standard_space_mesh is True
order = ["lh_pial_surf", "lh_wm_surf", "rh_pial_surf", "rh_wm_surf"]
for i, k in enumerate(order):
assert mesh_files[k] == str(
(std_mesh_dir / "sub-1648798153/ses-PNC1/anat").joinpath(files[i])
)

# Dataset with multiple files matching each query (raises an error)
bad_mesh_dir = tmp_path_factory.mktemp("standard_mesh")
Expand Down
7 changes: 4 additions & 3 deletions xcp_d/utils/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,11 @@ def collect_mesh_data(layout, participant_label, bids_filters):
LOGGER.info("No standard-space surfaces found.")

# Now that we know if there are standard-space surfaces available, we can grab the files.
query_extras = {}
if not standard_space_mesh:
query_extras = {"space": None}
if standard_space_mesh:
query_extras = {
"space": None,
"space": "fsLR",
"den": "32k",
}

initial_mesh_files = {}
Expand Down

0 comments on commit 9ed06b9

Please sign in to comment.