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

Collect entity-linked files in get_associations #1043

Open
tsalo opened this issue Feb 14, 2024 · 0 comments
Open

Collect entity-linked files in get_associations #1043

tsalo opened this issue Feb 14, 2024 · 0 comments

Comments

@tsalo
Copy link
Member

tsalo commented Feb 14, 2024

I'm not sure how feasible this is, given how little I know about SQL, but it seems like file collections should be gathered by get_associations.

For example, I tested on a single-subject multi-echo dataset (https://openneuro.org/datasets/ds002156):

from bids.layout import BIDSLayout, BIDSLayoutIndexer

dset_dir = "/path/to/ds002156"
indexer = BIDSLayoutIndexer(validate=False, index_metadata=True, ignore=["derivatives/"])
layout = BIDSLayout(dset_dir, derivatives=False, indexer=indexer)

me_files = layout.get(suffix="bold", extension="nii.gz")
me_file = me_files[0]

me_file.get_associations()

What I get is:

[<BIDSImageFile filename='/path/to/ds002156/sub-23638/ses-01/fmap/sub-23638_ses-01_acq-rest_dir-match_run-1_epi.nii.gz'>,
 <BIDSImageFile filename='/path/to/ds002156/sub-23638/ses-01/fmap/sub-23638_ses-01_acq-rest_dir-opp_run-1_epi.nii.gz'>,
 <BIDSJSONFile filename='/path/to/ds002156/sub-23638/ses-01/func/sub-23638_ses-01_task-rest_run-1_echo-1_bold.json'>,
 <BIDSDataFile filename='/path/to/ds002156/sub-23638/ses-01/func/sub-23638_ses-01_task-rest_run-1_physio.tsv.gz'>]

I would expect to see the other three echoes from that run in the list of associated files.

I know that the definition of a file collection can be a little ambiguous in BIDS. Most file collections share a suffix and vary along specific entities (e.g., echo, flip, inv, mt, and part), though some will have different suffixes (e.g., phase-difference field maps, which typically have a _phasediff map, a _magnitude1 map, and a _magnitude2 map). PyBIDS might need specific rules for the latter case.

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

No branches or pull requests

1 participant