Help with bids filter file

Summary of what happened:

I’m trying to create a bids filter file to be used with mriqc and/or fmriprep. It will include all scans in my project but there are times where I don’t want to include a specific func scan. I would like feedback on my config file for any potential issues or if anyone has a better suggestion for excluding a func scan I don’t want to include.

I want to include all fieldmaps in my project which is why I didn’t specify it further. This is just an example so I didn’t include all my func scans below.

Command used (and if a helper script was used, a link to the helper script or the command generated):

{
  "t1w": [
    {
      "datatype": "anat",
      "session": "01",
      "suffix": "T1w"
    }
  ],

  "fmap": [
    {
      "datatype": "fmap"
    }
  ],

  "bold": [
    {
      "datatype": "func",
      "session": "01",
      "task": "rest",
      "run": "01",
      "suffix": "bold"
    },
    {
      "datatype": "func",
      "session": "02",
      "task": "rest",
      "run": "01",
      "suffix": "bold"
    },
    {
      "datatype": "func",
      "session": "01",
      "task": "shuffle",
      "run": "01",
      "suffix": "bold"
    },
    {
      "datatype": "func",
      "session": "02",
      "task": "animation",
      "run": "01",
      "suffix": "bold"
    }
  ]
}


Hi @jypeters,

It will be hard to help without seeing the tree directory structure for an example subject.

Best,
Steven

Hi @Steven ,

Here is a tree for a sample subject:

├── ses-01
│   ├── anat
│   │   ├── sub-PILOT01_ses-01_T1w.json
│   │   └── sub-PILOT01_ses-01_T1w.nii.gz
│   ├── fmap
│   │   ├── sub-PILOT01_ses-01_dir-AP_run-01_epi.json
│   │   ├── sub-PILOT01_ses-01_dir-AP_run-01_epi.nii.gz
│   │   ├── sub-PILOT01_ses-01_dir-AP_run-02_epi.json
│   │   ├── sub-PILOT01_ses-01_dir-AP_run-02_epi.nii.gz
│   │   ├── sub-PILOT01_ses-01_dir-PA_run-01_epi.json
│   │   ├── sub-PILOT01_ses-01_dir-PA_run-01_epi.nii.gz
│   │   ├── sub-PILOT01_ses-01_dir-PA_run-02_epi.json
│   │   └── sub-PILOT01_ses-01_dir-PA_run-02_epi.nii.gz
│   └── func
│       ├── sub-PILOT01_ses-01_task-shuffle_run-01_bold.json
│       ├── sub-PILOT01_ses-01_task-shuffle_run-01_bold.nii.gz
│       ├── sub-PILOT01_ses-01_task-gamble_run-01_bold.json
│       ├── sub-PILOT01_ses-01_task-gamble_run-01_bold.nii.gz
│       ├── sub-PILOT01_ses-01_task-rest_run-01_bold.json
│       ├── sub-PILOT01_ses-01_task-rest_run-01_bold.nii.gz
│       ├── sub-PILOT01_ses-01_task-rest_run-02_bold.json
│       ├── sub-PILOT01_ses-01_task-rest_run-02_bold.nii.gz
│       ├── sub-PILOT01_ses-01_task-rest_run-03_bold.json
│       ├── sub-PILOT01_ses-01_task-rest_run-03_bold.nii.gz
│       ├── sub-PILOT01_ses-01_task-rest_run-04_bold.json
│       └── sub-PILOT01_ses-01_task-rest_run-04_bold.nii.gz
└── ses-02
    ├── fmap
    │   ├── sub-PILOT01_ses-02_dir-AP_run-01_epi.json
    │   ├── sub-PILOT01_ses-02_dir-AP_run-01_epi.nii.gz
    │   ├── sub-PILOT01_ses-02_dir-AP_run-02_epi.json
    │   ├── sub-PILOT01_ses-02_dir-AP_run-02_epi.nii.gz
    │   ├── sub-PILOT01_ses-02_dir-PA_run-01_epi.json
    │   ├── sub-PILOT01_ses-02_dir-PA_run-01_epi.nii.gz
    │   ├── sub-PILOT01_ses-02_dir-PA_run-02_epi.json
    │   └── sub-PILOT01_ses-02_dir-PA_run-02_epi.nii.gz
    └── func
        ├── sub-PILOT01_ses-02_task-cartoon_run-01_bold.json
        ├── sub-PILOT01_ses-02_task-cartoon_run-01_bold.nii.gz
        ├── sub-PILOT01_ses-02_task-rest_run-01_bold.json
        ├── sub-PILOT01_ses-02_task-rest_run-01_bold.nii.gz
        ├── sub-PILOT01_ses-02_task-rest_run-02_bold.json
        ├── sub-PILOT01_ses-02_task-rest_run-02_bold.nii.gz
        ├── sub-PILOT01_ses-02_task-rest_run-03_bold.json
        ├── sub-PILOT01_ses-02_task-rest_run-03_bold.nii.gz
        ├── sub-PILOT01_ses-02_task-rest_run-04_bold.json
        └── sub-PILOT01_ses-02_task-rest_run-04_bold.nii.gz

Hi @jypeters,

I guess the filter will depend on what scan you want to exclude. It is certainly safe to have a filter element for each possible scan (session, task, run, etc), that you can remove as needed. If you want to get fancy, I think (not sure) that filter files can use regex style patterns to perform exclusion. But if not, something like what you have should be fine. Have you tested it?

Best,
Steven