Skip to content

Commit f927f34

Browse files
authored
Fix ingression of standard-space mesh files (#1309)
1 parent 9275de8 commit f927f34

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

xcp_d/tests/test_utils_bids.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,25 @@ def test_collect_mesh_data(datasets, tmp_path_factory):
152152
"sub-1648798153_ses-PNC1_hemi-L_space-fsLR_den-32k_white.surf.gii",
153153
"sub-1648798153_ses-PNC1_hemi-R_space-fsLR_den-32k_pial.surf.gii",
154154
"sub-1648798153_ses-PNC1_hemi-R_space-fsLR_den-32k_white.surf.gii",
155+
"sub-1648798153_ses-PNC1_hemi-L_pial.surf.gii",
156+
"sub-1648798153_ses-PNC1_hemi-L_white.surf.gii",
157+
"sub-1648798153_ses-PNC1_hemi-R_pial.surf.gii",
158+
"sub-1648798153_ses-PNC1_hemi-R_white.surf.gii",
155159
]
156160
for f in files:
157161
(std_mesh_dir / "sub-1648798153/ses-PNC1/anat").joinpath(f).touch()
158162

159163
layout = BIDSLayout(std_mesh_dir, validate=False)
160-
mesh_available, standard_space_mesh, _, _ = xbids.collect_mesh_data(
164+
mesh_available, standard_space_mesh, _, mesh_files = xbids.collect_mesh_data(
161165
layout, "1648798153", bids_filters={}
162166
)
163167
assert mesh_available is True
164168
assert standard_space_mesh is True
169+
order = ["lh_pial_surf", "lh_wm_surf", "rh_pial_surf", "rh_wm_surf"]
170+
for i, k in enumerate(order):
171+
assert mesh_files[k] == str(
172+
(std_mesh_dir / "sub-1648798153/ses-PNC1/anat").joinpath(files[i])
173+
)
165174

166175
# Dataset with multiple files matching each query (raises an error)
167176
bad_mesh_dir = tmp_path_factory.mktemp("standard_mesh")

xcp_d/utils/bids.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,11 @@ def collect_mesh_data(layout, participant_label, bids_filters):
415415
LOGGER.info("No standard-space surfaces found.")
416416

417417
# Now that we know if there are standard-space surfaces available, we can grab the files.
418-
query_extras = {}
419-
if not standard_space_mesh:
418+
query_extras = {"space": None}
419+
if standard_space_mesh:
420420
query_extras = {
421-
"space": None,
421+
"space": "fsLR",
422+
"den": "32k",
422423
}
423424

424425
initial_mesh_files = {}

0 commit comments

Comments
 (0)