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

DOC: BIDS filter input example #2028

Merged
merged 6 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,40 @@ After getting the resources you'll need, you will just need to make sure your
runtime environment is able to access the filesystem, at the location of your
*TemplateFlow home* directory.
If you are a Singularity user, please check out :ref:`singularity_tf`.

How do I select only certain files to be input to fMRIPrep?
-----------------------------------------------------------

Using the ``--bids-filter-file`` flag, you can pass fMRIPrep a JSON file that
describes a custom BIDS filter for selecting files with PyBIDS, with the syntax
``{<query>: {<entity>: <filter>, ...},...}``. For example::

{
"t1w": {
"datatype": "anat",
"session": "02",
"acquisition": null,
"suffix": "T1w"
},
"bold": {
"datatype": "func",
"session": "02",
"suffix": "bold"
}
}

fMRIPrep uses the following queries, by default::

{
'fmap': {'datatype': 'fmap'},
'bold': {'datatype': 'func', 'suffix': 'bold'},
'sbref': {'datatype': 'func', 'suffix': 'sbref'},
'flair': {'datatype': 'anat', 'suffix': 'FLAIR'},
't2w': {'datatype': 'anat', 'suffix': 'T2w'},
't1w': {'datatype': 'anat', 'suffix': 'T1w'},
'roi': {'datatype': 'anat', 'suffix': 'roi'},
}

Only modifications of these queries will have any effect. You may filter on any entity defined
in the the PyBIDS
`config file <https://github.com/bids-standard/pybids/blob/master/bids/layout/config/bids.json>`__.
8 changes: 5 additions & 3 deletions fmriprep/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ def get_parser():
# help='select a specific run to be processed')
g_bids.add_argument(
'--bids-filter-file', action='store', type=Path, metavar='PATH',
help='a JSON file describing custom BIDS input filter using pybids '
'{<suffix>:{<entity>:<filter>,...},...} '
'(https://github.com/bids-standard/pybids/blob/master/bids/layout/config/bids.json)')
help="a JSON file describing custom BIDS input filters using PyBIDS. "
"For further details, please check out "
"https://fmriprep.readthedocs.io/en/%s/faq.html#"
"how-do-I-select-only-certain-files-to-be-input-to-fMRIPrep" % (
currentv.base_version if is_release else 'latest'))
g_bids.add_argument('-t', '--task-id', action='store',
help='select a specific task to be processed')
g_bids.add_argument('--echo-idx', action='store', type=int,
Expand Down