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

Fieldmaps do not find metadata when part-{mag,phase} are present and a single sidecar is given #1032

Closed
oesteban opened this issue Nov 28, 2023 · 7 comments
Labels

Comments

@oesteban
Copy link
Collaborator

I have:

sub-001/ses-001/fmap/sub-001_ses-001_acq-bold_dir-AP_epi.json
sub-001/ses-001/fmap/sub-001_ses-001_acq-bold_dir-AP_part-mag_epi.nii.gz
sub-001/ses-001/fmap/sub-001_ses-001_acq-bold_dir-AP_part-phase_epi.nii.gz

I would expect that get_metadata (or access the metadata member, whatever is the current way of accessing it) for either the magnitude or the phase would retrieve the metadata from the common json sidecar.

I would also expect higher-level metadata be extracted from /acq-bold_epi.json, in this case.

@oesteban oesteban added the bug label Nov 28, 2023
@oesteban
Copy link
Collaborator Author

Or did I misunderstand the BIDS specs, @effigies ?

@effigies
Copy link
Collaborator

I would expect inheritance to apply here.

@oesteban
Copy link
Collaborator Author

I would expect inheritance to apply here.

So, to be clear, you would expect that the metadata in /sub-001/ses-001/fmap/sub-001_ses-001_acq-bold_dir-AP_epi.json and /acq-bold_epi.json both apply?

@Remi-Gau
Copy link
Contributor

Remi-Gau commented Nov 28, 2023

yes though those from /sub-001/ses-001/fmap/sub-001_ses-001_acq-bold_dir-AP_epi.json would override any from /acq-bold_epi.json

@oesteban
Copy link
Collaborator Author

Thanks.

For a start skimming the code, ext_key is undefined here:

pybids/bids/layout/index.py

Lines 268 to 272 in 8fb92fa

if filters.get(ext_key):
filters[ext_key] = listify(filters[ext_key])
# ensure json files are being indexed
if '.json' not in filters[ext_key]:
filters[ext_key].append('.json')

@oesteban
Copy link
Collaborator Author

Okay, false alarm -- I was using an old version of the command line without --index-metadata. This indeed works, so I'm closing. The undefined variable is there though, should I open an issue?

@effigies
Copy link
Collaborator

Yeah. Looks like the definition was removed in b1140ee. ext_key should just become 'extension'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants