Bids-filter-files flag doesn't work

Hi, everyone.

I’m trying to filter bids so that only *acq-VNav* T1w image is passed to fmriprep.
This is my input json file for –bids-filter-file flag.

t1_spec.json

{
“t1w”: {
“datatype”: “anat”,
“acquisition”: “VNav”,
}
}

But, it doesn’ work… All 3 T1 images (HCP,VNav,VNavNorm) are passed and end up merged T1 template. I want to make T1 template soley driven by VNav.

What is the problem?? (fmriprep version-20.2.1)

Is there an error message? If so, can you post it?

Just looking at your json, there is a syntax error. Unlike python, jsons do not allow trailing commas for the final item in lists or dicts, so remove the comma after “VNav” like this:

{
“t1w”: {
“datatype”: “anat”,
“acquisition”: “VNav”
}
}
1 Like

This is my warning message!

/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/validation.py:46: UserWarning: 
The ability to pass arguments to BIDSLayout that control indexing is likely to be removed in future; possibly as early as PyBIDS 0.14. 
This includes the `config_filename`, `ignore`, `force_index`, and `index_metadata` arguments. 
The recommended usage pattern is to initialize a new BIDSLayoutIndexer with these arguments, and pass it to the BIDSLayout via the `indexer` argument.
  warnings.warn("The ability to pass arguments to BIDSLayout that control "

Oh, i’ll try json file without trailing commas!

output/anat/
image

I suppose still all T1 images are passed to fmriprep…

Could you open an issue on Issues · nipreps/smriprep · GitHub? While Neurostars is good for community help, issues are better for bugs.

1 Like

Hi Everyone,

I see that this is an older issue but I’m having the same problem and the solution does not work for me. I passed a --bids-filter-file flag yet fmriprep is pulling all session, all tasks and throwing no errors. My filter file is:
{
“fmap”: {
“datatype”: “fmap”,
“session”: “MR1”,
“suffix”:“epi”,
“run”:“3”
},
“t1w”: {
“datatype”: “anat”,
“session”: “MR1”,
“suffix”: “T1w”
},
“bold”: {
“datatype”: “func”,
“session”: “MR1”,
“suffix”: “bold”,
“task”:“gambling”
}
}

I have the same problem- I want to use a specific T1w acquisition, so my --bids-filter-file looks like this:

{
“t1w”: {
“datatype”: “anat”,
“acquisition”: “qsiprep”,
“suffix”: “T1w”
},
}

fmriprep runs without any error but doesn’t apply the filter. Is this a syntax issue? Should the filter file include all other modalities as well if I’m only interested in filtering the T1w?
I saw the github issue about fixing this such that fmriprep throws an error instead of simply ignoring the file (FIX: non-existing path or JSON syntax error for `--bids-filter-file` should raise on error. by bpinsard · Pull Request #2331 · nipreps/fmriprep · GitHub), but would it possible in addition to elaborate on the correct syntax for the bids-filter-file, as this seems to be a recurring problem… ?
Thanks!