{
  "name": "bids",
  "entities": [
    {
      "name": "subject",
      "pattern": "[/\\\\]+sub-([a-zA-Z0-9]+)",
      "directory": "{subject}"
    },
    {
      "name": "session",
      "pattern": "[_/\\\\]+ses-([a-zA-Z0-9]+)",
      "mandatory": false,
      "directory": "{subject}{session}"
    },
    {
      "name": "task",
      "pattern": "[_/\\\\]+task-([a-zA-Z0-9]+)"
    },
    {
      "name": "acquisition",
      "pattern": "[_/\\\\]+acq-([a-zA-Z0-9]+)"
    },
    {
      "name": "ce",
      "pattern": "[_/\\\\]+ce-([a-zA-Z0-9]+)"
    },
    {
      "name": "reconstruction",
      "pattern": "[_/\\\\]+rec-([a-zA-Z0-9]+)"
    },
    {
      "name": "dir",
      "pattern": "[_/\\\\]+dir-([a-zA-Z0-9]+)"
    },
    {
      "name": "run",
      "pattern": "[_/\\\\]+run-0*(\\d+)",
      "dtype": "int"
    },
    {
      "name": "proc",
      "pattern": "[_/\\\\]+proc-([a-zA-Z0-9]+)"
    },
    {
      "name": "modality",
      "pattern": "[_/\\\\]+mod-([a-zA-Z0-9]+)"
    },
    {
      "name": "echo",
      "pattern": "[_/\\\\]+echo-([0-9]+)\\_bold."
    },
    {
      "name": "recording",
      "pattern": "[_/\\\\]+recording-([a-zA-Z0-9]+)"
    },
    {
      "name": "suffix",
      "pattern": "[._]*([a-zA-Z0-9]*?)\\.[^/\\\\]+$"
    },
    {
      "name": "scans",
      "pattern": "(.*\\_scans.tsv)$"
    },
    {
      "name": "fmap",
      "pattern": "(phasediff|magnitude[1-2]|phase[1-2]|fieldmap|epi)\\.nii"
    },
    {
      "name": "datatype",
      "pattern": "[/\\\\]+(func|anat|fmap|dwi|meg)[/\\\\]+s"
    },
    {
      "name": "extension",
      "pattern": "[._]*[a-zA-Z0-9]*?\\.([^/\\\\]+)$"
    }
    ],

  "default_path_patterns": [
    "sub-{subject}[/ses-{session}]/anat/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{contrast}][_rec-{reconstruction}]_{suffix<T1w|T2w|T1rho|T1map|T2map|T2star|FLAIR|FLASH|PDmap|PD|PDT2|inplaneT[12]|angio>}.nii.gz",
    "sub-{subject}[/ses-{session}]/anat/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{contrast}][_rec-{reconstruction}][_mod-{modality}]_{suffix<defacemask>}.nii.gz",
    "sub-{subject}[/ses-{session}]/func/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}]_{suffix<bold>}.nii.gz",
    "sub-{subject}[/ses-{session}]/dwi/sub-{subject}[_ses-{session}][_acq-{acquisition}]_{suffix<dwi>}.{extension<bval|bvec|json|nii\\.gz|nii>|nii\\.gz}",
    "sub-{subject}[/ses-{session}]/fmap/sub-{subject}[_ses-{session}][_acq-{acquisition}][_dir-{direction}][_run-{run}]_{fmap<phasediff|magnitude[1-2]|phase[1-2]|fieldmap|epi>}.nii.gz",
    "sub-{subject}[/ses-{session}]/[{datatype<func|meg>|func}/]sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}][_recording-{recording}]_{suffix<events>}.{extension<tsv>|tsv}",
    "sub-{subject}[/ses-{session}]/func/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}][_recording-{recording}]_{suffix<physio|stim>}.{extension<tsv\\.gz|json}",
    "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_run-{run}][_proc-{proc}]_meg.{extension|json}",
    "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_run-{run}][_proc-{proc}]_{suffix<channels>}.{extension<tsv>|tsv}",
    "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}]_{suffix<coordsystem>}.json",
    "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}]_{suffix<photo>}.jpg"
    ]
}

