Skip to content

Enable filtering of specific subject session pairsΒ #67

@ghisvail

Description

@ghisvail

I work on pydra-bids, a set of Pydra tasks to manipulate BIDS datasets and powered by ancpbids under the hood.

The Clinica project aims at replacing their custom query logic with pydra-bids and there is an important feature currently missing. They are dealing with longitudinal datasets with a rather large range of subjects and sessions and would want to filter processing to a subset of them.

Right now, it seems that ancpbids.BIDSLayout.get only support filtering a subset of participants amongst all participants and / or a subset of sessions amongst all sessions. How about supporting a specific set of subject session pairs?

The way I see it, this feature could be introduced with a new parameter like:

class BIDSLayout:
    def get(..., subject_session_pairs: Iterable[Tuple[str, str]]):
        ...

layout = BIDSLayout("/path/to/bids/dataset")
query = {"return_type": "files", "suffix": "T1w"}

# Query session M00 of participant P01
# and session M12 of participant P02.
subject_session_pairs = [
    ("P01", "M00"),
    ("P02", "M12"),
]

files = layout.get(subject_session_pairs=subject_session_pairs, **query)

What do you think? Would it be difficult to implement given the existing design?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions