Skip to content

Commit

Permalink
ENH: Leverage pybids functionality
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Markiewicz <markiewicz@stanford.edu>
  • Loading branch information
mgxd and effigies committed Mar 29, 2022
1 parent 1993589 commit 61a1df9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions niworkflows/utils/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import re
import warnings
from bids import BIDSLayout
from bids.layout import Query
from packaging.version import Version


Expand Down Expand Up @@ -149,7 +150,7 @@ def collect_participants(
def collect_data(
bids_dir,
participant_label,
session_id=False,
session_id=Query.ANY,
task=None,
echo=None,
bids_validate=True,
Expand All @@ -168,8 +169,8 @@ def collect_data(
The BIDS directory
participant_label : :obj:`str`
The participant identifier
session_id : :obj:`str`, None, or ``False``
The session identifier. If ``False``, all sessions will be used (default).
session_id : :obj:`str`, None, or :obj:`bids.layout.Query`
The session identifier. By default, all sessions will be used.
task : :obj:`str` or None
The task identifier (for BOLD queries)
echo : :obj:`int` or None
Expand Down Expand Up @@ -235,15 +236,12 @@ def collect_data(
if echo:
queries["bold"]["echo"] = echo

if session_id is not False:
for acq in queries.keys():
queries[acq]["session"] = session_id

subj_data = {
dtype: sorted(
layout.get(
return_type="file",
subject=participant_label,
session=session_id,
extension=[".nii", ".nii.gz"],
**query,
)
Expand Down

0 comments on commit 61a1df9

Please sign in to comment.