bids-standard / pybids

Python tools for querying and manipulating BIDS datasets.
https://bids-standard.github.io/pybids/
MIT License
225 stars 122 forks source link

What are the possible kinds of associations? #773

Open mateuszpawlik opened 3 years ago

mateuszpawlik commented 3 years ago

I'd like to filter the output of get_associations() by kind. Unfortunately, I fail to find any documentation on the association kinds. There is some info in #431 but it's not a final list. I've also found some strings by backtracking the references of create_association_pair function:

Found 6 references in 1 file
bids/layout/index.py

create_association_pair(js_file, bf.path, 'Metadata')
create_association_pair(js_file, other, 'Child', 'Parent')
create_association_pair(src, dst, 'Child', 'Parent')
create_association_pair(bf.path, str(target), 'IntendedFor',
create_association_pair(bf.path, img, 'IntendedFor',
create_association_pair(bf.path, img, 'IntendedFor',

It is rather difficult to guess the correct association kinds not knowing how the dataset is indexed. Maybe having the database schema would help. For example, is a json file a child or parent of an image file?

Moreover, in the documentation I miss the information that the dataset has to be indexed with metadata to have associations.

mateuszpawlik commented 3 years ago

By guessing and trying I've found out that a sidecar json file is associated with the corresponding image file as kind='Metadata'. Thus, nifti_file.get_associations(kind='Metadata') returns me the json file.