main 409a857932d3 cached
91 files
251.4 KB
65.0k tokens
9 symbols
1 requests
Download .txt
Showing preview only (278K chars total). Download the full file or copy to clipboard to get everything.
Repository: bids-standard/bids-starter-kit
Branch: main
Commit: 409a857932d3
Files: 91
Total size: 251.4 KB

Directory structure:
gitextract_ajxyoq0h/

├── .all-contributorsrc
├── .github/
│   └── workflows/
│       └── deploy_book.yml
├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── interactiveTreeVisualization/
│   └── epilepsyClassification2017/
│       ├── tree.html
│       ├── treeData.js
│       ├── treeFunctions.js
│       └── treeStyle.css
├── matlabCode/
│   ├── anat/
│   │   ├── createBIDS_T1w_json_full.m
│   │   ├── createBIDS_T1w_json_full_schma_based.m
│   │   └── createBIDS_T1w_json_short.m
│   ├── eeg-meg/
│   │   ├── createBIDS_meg_json_full.m
│   │   ├── createBIDS_meg_json_short.m
│   │   └── rename_brainvision_files.m
│   ├── fmap/
│   │   └── createBIDS_fmap_json.m
│   ├── func/
│   │   ├── createBIDS_bold_json_full.m
│   │   └── createBIDS_bold_json_short.m
│   ├── general/
│   │   ├── README.md
│   │   ├── bids_spreadsheet2participants.m
│   │   ├── createBIDS_dataset_description_json.m
│   │   ├── createBIDS_events_tsv_json_full.m
│   │   ├── createBIDS_participants_tsv.m
│   │   ├── createBIDS_samples_tsv.m
│   │   ├── input/
│   │   │   └── spreadsheet_to_convert.xlsx
│   │   └── tests/
│   │       ├── data/
│   │       │   ├── participants.json
│   │       │   └── participants.tsv
│   │       └── test_bids_spreadsheet2participants.m
│   ├── ieeg/
│   │   ├── createBIDS_channels_tsv.m
│   │   ├── createBIDS_coordsystem_json.m
│   │   ├── createBIDS_data_WriteBrainVisionWithFieldtrip.m
│   │   ├── createBIDS_electrodes_tsv.m
│   │   └── createBIDS_ieeg_json.m
│   ├── micr/
│   │   ├── createBIDS_micr_json_full.m
│   │   └── createBIDS_micr_json_short.m
│   ├── miss_hit.cfg
│   └── pet/
│       ├── createBIDS_blood_auto_tsv_and_json_short.m
│       ├── createBIDS_blood_manual_tsv_and_json_full.m
│       ├── createBIDS_blood_manual_tsv_and_json_short.m
│       ├── createBIDS_pet_json_full.m
│       └── createBIDS_pet_json_short.m
├── pythonCode/
│   ├── createBIDS_MP2RAGE_json.py
│   └── createBIDS_dataset_description_json.py
├── reports/
│   └── Google-2018-report.md
├── src/
│   ├── CONTRIBUTING.md
│   ├── _config.yml
│   ├── _toc.yml
│   ├── epilepsy_phenotype.rst
│   ├── index.md
│   ├── references.bib
│   └── tree.html
└── templates/
    ├── participants.json
    ├── participants.tsv
    ├── phenotype/
    │   ├── EpilepsyClassification.tsv
    │   └── EpilepsyClassification2017.json
    ├── samples.json
    ├── samples.tsv
    ├── sub-01/
    │   └── ses-01/
    │       ├── anat/
    │       │   ├── sub-01_ses-01_acq-FullExample_run-01_T1w.json
    │       │   └── sub-01_ses-01_acq-ShortExample_run-01_T1w.json
    │       ├── eeg/
    │       │   ├── sub-01_ses-01_task-FilterExample_eeg.json
    │       │   ├── sub-01_ses-01_task-FullExample_eeg.json
    │       │   ├── sub-01_ses-01_task-MinimalExample_eeg.json
    │       │   └── sub-01_ses-01_task-ReferenceExample_eeg.json
    │       ├── fmap/
    │       │   ├── sub-01_ses-01_acq-Case1_run-01_phasediff.json
    │       │   ├── sub-01_ses-01_acq-Case2_run-01_phase1.json
    │       │   ├── sub-01_ses-01_acq-Case2_run-01_phase2.json
    │       │   ├── sub-01_ses-01_acq-Case3_run-01_fieldmap.json
    │       │   └── sub-01_ses-01_acq-Case4_dir-LR_run-01_epi.json
    │       ├── func/
    │       │   ├── sub-01_ses-01_task-FullExample_run-01_bold.json
    │       │   ├── sub-01_ses-01_task-FullExample_run-01_events.json
    │       │   ├── sub-01_ses-01_task-FullExample_run-01_events.tsv
    │       │   └── sub-01_ses-01_task-ShortExample_run-01_bold.json
    │       ├── ieeg/
    │       │   ├── sub-01_ses-01_coordsystem.json
    │       │   ├── sub-01_ses-01_electrodes.tsv
    │       │   ├── sub-01_ses-01_task-LongExample_run-01_channels.tsv
    │       │   └── sub-01_ses-01_task-LongExample_run-01_ieeg.json
    │       ├── meg/
    │       │   ├── sub-01_ses-01_task-FullExample_acq-CTF_run-1_proc-sss_meg.json
    │       │   └── sub-01_ses-01_task-ShortExample_acq-CTF_run-1_proc-sss_meg.json
    │       ├── micr/
    │       │   ├── sub-01_ses-01_sample-01_acq-Full_stain-03_chunk-01_SEM.json
    │       │   └── sub-01_ses-01_sample-01_acq-Short_stain-03_chunk-01_SEM.json
    │       └── pet/
    │           ├── sub-01_ses-01_recording-AutosamplerShortExample_blood.json
    │           ├── sub-01_ses-01_recording-AutosamplerShortExample_blood.tsv
    │           ├── sub-01_ses-01_recording-ManualFullExample_blood.json
    │           ├── sub-01_ses-01_recording-ManualFullExample_blood.tsv
    │           ├── sub-01_ses-01_recording-ManualShortExample_blood.json
    │           ├── sub-01_ses-01_recording-ManualShortExample_blood.tsv
    │           ├── sub-01_ses-01_task-FullExample_pet.json
    │           └── sub-01_ses-01_task-ShortExample_pet.json
    └── sub-epilepsy01/
        └── ses-01/
            └── ieeg/
                ├── sub-epilepsy01_ses-01_electrodes.json
                └── sub-epilepsy01_ses-01_electrodes.tsv

================================================
FILE CONTENTS
================================================

================================================
FILE: .all-contributorsrc
================================================
{
  "files": [
    "README.md"
  ],
  "imageSize": 100,
  "commit": false,
  "contributors": [
    {
      "login": "dorahermes",
      "name": "Dora Hermes",
      "avatar_url": "https://avatars1.githubusercontent.com/u/4977351?v=4",
      "profile": "https://github.com/dorahermes",
      "contributions": [
        "code",
        "content",
        "ideas",
        "review",
        "maintenance",
        "doc"
      ]
    },
    {
      "login": "chrisgorgo",
      "name": "Chris Gorgolewski",
      "avatar_url": "https://avatars2.githubusercontent.com/u/238759?v=4",
      "profile": "http://chrisgorgolewski.org",
      "contributions": [
        "review",
        "maintenance",
        "bug"
      ]
    },
    {
      "login": "choldgraf",
      "name": "Chris Holdgraf",
      "avatar_url": "https://avatars1.githubusercontent.com/u/1839645?v=4",
      "profile": "http://chrisholdgraf.com",
      "contributions": [
        "review",
        "content",
        "maintenance"
      ]
    },
    {
      "login": "cofficer",
      "name": "Chris Gahnström",
      "avatar_url": "https://avatars1.githubusercontent.com/u/12600386?v=4",
      "profile": "https://chrisgahnstrom.wordpress.com/",
      "contributions": [
        "code",
        "content",
        "ideas"
      ]
    },
    {
      "login": "emdupre",
      "name": "Elizabeth DuPre",
      "avatar_url": "https://avatars3.githubusercontent.com/u/15017191?v=4",
      "profile": "http://emdupre.me",
      "contributions": [
        "review",
        "maintenance",
        "ideas",
        "content",
        "doc"
      ]
    },
    {
      "login": "anushkab",
      "name": "Utmost Happiness",
      "avatar_url": "https://avatars0.githubusercontent.com/u/20943511?v=4",
      "profile": "https://github.com/anushkab",
      "contributions": [
        "code",
        "content",
        "ideas"
      ]
    },
    {
      "login": "KirstieJane",
      "name": "Kirstie Whitaker",
      "avatar_url": "https://avatars1.githubusercontent.com/u/3626306?v=4",
      "profile": "https://whitakerlab.github.io",
      "contributions": [
        "review",
        "ideas",
        "maintenance",
        "content",
        "doc",
        "bug"
      ]
    },
    {
      "login": "Park-Patrick",
      "name": "Patrick Park",
      "avatar_url": "https://avatars3.githubusercontent.com/u/12662110?v=4",
      "profile": "https://github.com/Park-Patrick",
      "contributions": [
        "ideas",
        "content",
        "review"
      ]
    },
    {
      "login": "PeerHerholz",
      "name": "Peer Herholz",
      "avatar_url": "https://avatars0.githubusercontent.com/u/20129524?v=4",
      "profile": "http://peerherholz.github.io",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "CPernet",
      "name": "Cyril Pernet",
      "avatar_url": "https://avatars2.githubusercontent.com/u/4772878?v=4",
      "profile": "http://www.sbirc.ed.ac.uk/cyril/",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "sappelhoff",
      "name": "Stefan Appelhoff",
      "avatar_url": "https://avatars1.githubusercontent.com/u/9084751?v=4",
      "profile": "https://www.stefanappelhoff.com",
      "contributions": [
        "review",
        "code",
        "content",
        "ideas"
      ]
    },
    {
      "login": "ilkayisik",
      "name": "Ilkay Isik",
      "avatar_url": "https://avatars1.githubusercontent.com/u/22478219?v=4",
      "profile": "https://ilkayisik.github.io",
      "contributions": [
        "bug"
      ]
    },
    {
      "login": "teonbrooks",
      "name": "Teon L Brooks",
      "avatar_url": "https://avatars1.githubusercontent.com/u/1578674?v=4",
      "profile": "https://teonbrooks.com",
      "contributions": [
        "bug"
      ]
    },
    {
      "login": "bayab",
      "name": "ayab",
      "avatar_url": "https://avatars0.githubusercontent.com/u/16117420?v=4",
      "profile": "https://github.com/bayab",
      "contributions": [
        "content"
      ]
    },
    {
      "login": "Remi-Gau",
      "name": "Remi Gau",
      "avatar_url": "https://avatars3.githubusercontent.com/u/6961185?v=4",
      "profile": "https://remi-gau.github.io/",
      "contributions": [
        "content"
      ]
    },
    {
      "login": "JaapVanDerAar",
      "name": "Jaap van der Aar",
      "avatar_url": "https://avatars3.githubusercontent.com/u/32334327?v=4",
      "profile": "https://github.com/JaapVanDerAar",
      "contributions": [
        "code",
        "content",
        "ideas"
      ]
    },
    {
      "login": "GiulioCastegnaro",
      "name": "Giulio Castegnaro",
      "avatar_url": "https://avatars2.githubusercontent.com/u/45361920?v=4",
      "profile": "https://github.com/GiulioCastegnaro",
      "contributions": [
        "code",
        "content",
        "ideas"
      ]
    },
    {
      "login": "franklin-feingold",
      "name": "Franklin Feingold",
      "avatar_url": "https://avatars1.githubusercontent.com/u/35307458?v=4",
      "profile": "https://github.com/franklin-feingold",
      "contributions": [
        "bug",
        "review"
      ]
    },
    {
      "login": "nicholst",
      "name": "Thomas Nichols",
      "avatar_url": "https://avatars3.githubusercontent.com/u/5155907?v=4",
      "profile": "http://www.nisox.org",
      "contributions": [
        "review"
      ]
    },
    {
      "login": "pvdemael",
      "name": "Pieter Vandemaele",
      "avatar_url": "https://avatars1.githubusercontent.com/u/37624277?v=4",
      "profile": "https://github.com/pvdemael",
      "contributions": [
        "bug"
      ]
    },
    {
      "login": "gllmflndn",
      "name": "Guillaume Flandin",
      "avatar_url": "https://avatars0.githubusercontent.com/u/5950855?v=4",
      "profile": "https://github.com/gllmflndn",
      "contributions": [
        "review",
        "ideas"
      ]
    },
    {
      "login": "robertoostenveld",
      "name": "Robert Oostenveld",
      "avatar_url": "https://avatars1.githubusercontent.com/u/899043?v=4",
      "profile": "https://github.com/robertoostenveld",
      "contributions": [
        "bug",
        "review",
        "ideas"
      ]
    },
    {
      "login": "HappyFacade",
      "name": "Happy",
      "avatar_url": "https://avatars0.githubusercontent.com/u/54226355?v=4",
      "profile": "https://github.com/HappyFacade",
      "contributions": [
        "content"
      ]
    },
    {
      "login": "tpatpa",
      "name": "Tal Pal Attia",
      "avatar_url": "https://avatars1.githubusercontent.com/u/24300712?v=4",
      "profile": "https://www.linkedin.com/in/tal-pal-attia-201373b0/",
      "contributions": [
        "code"
      ]
    },
    {
      "login": "VisLab",
      "name": "Kay Robbins",
      "avatar_url": "https://avatars1.githubusercontent.com/u/1189050?v=4",
      "profile": "https://github.com/VisLab",
      "contributions": [
        "ideas",
        "content"
      ]
    },
    {
      "login": "eduardklap",
      "name": "Eduard Klapwijk",
      "avatar_url": "https://avatars1.githubusercontent.com/u/41283173?v=4",
      "profile": "https://erasmus-synclab.nl/",
      "contributions": [
        "ideas"
      ]
    },
    {
      "login": "DorienHuijser",
      "name": "Dorien Huijser",
      "avatar_url": "https://avatars1.githubusercontent.com/u/58177697?v=4",
      "profile": "https://github.com/DorienHuijser",
      "contributions": [
        "ideas"
      ]
    },
    {
      "login": "Arshitha",
      "name": "Arshitha Basavaraj",
      "avatar_url": "https://avatars1.githubusercontent.com/u/10297203?v=4",
      "profile": "http://cmn.nimh.nih.gov/dsst",
      "contributions": [
        "ideas"
      ]
    },
    {
      "login": "lnnrtwttkhn",
      "name": "Lennart Wittkuhn",
      "avatar_url": "https://avatars0.githubusercontent.com/u/42233065?v=4",
      "profile": "https://lennartwittkuhn.com",
      "contributions": [
        "ideas"
      ]
    },
    {
      "login": "bendhouseart",
      "name": "Anthony Galassi",
      "avatar_url": "https://avatars.githubusercontent.com/u/28850131?v=4",
      "profile": "https://github.com/bendhouseart",
      "contributions": [
        "ideas",
        "code"
      ]
    },
    {
      "login": "Athanasiamo",
      "name": "Athanasia Monika Mowinckel",
      "avatar_url": "https://avatars.githubusercontent.com/u/14014329?v=4",
      "profile": "http://DrMowinckels.io",
      "contributions": [
        "ideas",
        "code"
      ]
    },
    {
      "login": "yonestar",
      "name": "Yoni Ashar",
      "avatar_url": "https://avatars.githubusercontent.com/u/4513934?v=4",
      "profile": "https://github.com/yonestar",
      "contributions": [
        "ideas"
      ]
    },
    {
      "login": "dkp",
      "name": "dkp",
      "avatar_url": "https://avatars.githubusercontent.com/u/965184?v=4",
      "profile": "https://github.com/dkp",
      "contributions": [
        "bug"
      ]
    },
    {
      "login": "jdkent",
      "name": "James Kent",
      "avatar_url": "https://avatars.githubusercontent.com/u/12564882?v=4",
      "profile": "https://jdkent.github.io/",
      "contributions": [
        "ideas"
      ]
    },
    {
      "login": "cfxb",
      "name": "Chris Benjamin",
      "avatar_url": "https://avatars.githubusercontent.com/u/39246257?v=4",
      "profile": "https://github.com/cfxb",
      "contributions": [
        "doc"
      ]
    },
    {
      "login": "Islast",
      "name": "Isla",
      "avatar_url": "https://avatars.githubusercontent.com/u/23707851?v=4",
      "profile": "http://isla.st",
      "contributions": [
        "doc"
      ]
    },
    {
      "login": "effigies",
      "name": "Chris Markiewicz",
      "avatar_url": "https://avatars.githubusercontent.com/u/83442?v=4",
      "profile": "https://github.com/effigies",
      "contributions": [
        "doc"
      ]
    },
    {
      "login": "ankiitgupta7",
      "name": "Ankit Gupta",
      "avatar_url": "https://avatars.githubusercontent.com/u/25341569?v=4",
      "profile": "https://ankiitgupta7.github.io/",
      "contributions": [
        "doc"
      ]
    },
    {
      "login": "alexvonlautz",
      "name": "Alex von Lautz",
      "avatar_url": "https://avatars.githubusercontent.com/u/44004062?v=4",
      "profile": "https://github.com/alexvonlautz",
      "contributions": [
        "doc"
      ]
    },
    {
      "login": "AlexandreHutton",
      "name": "Alexandre Hutton",
      "avatar_url": "https://avatars.githubusercontent.com/u/50920802?v=4",
      "profile": "https://github.com/AlexandreHutton",
      "contributions": [
        "doc"
      ]
    },
    {
      "login": "AbrrenC",
      "name": "Abrren Chen",
      "avatar_url": "https://avatars.githubusercontent.com/u/54808990?v=4",
      "profile": "http://Abrren_Chen",
      "contributions": [
        "maintenance"
      ]
    },
    {
      "login": "Gabomfim",
      "name": "Gabriel Silveira",
      "avatar_url": "https://avatars.githubusercontent.com/u/21208915?v=4",
      "profile": "http://gabrielabs.com",
      "contributions": [
        "bug",
        "code"
      ]
    },
    {
      "login": "1nathanliang",
      "name": "nathan liang",
      "avatar_url": "https://avatars.githubusercontent.com/u/36468637?v=4",
      "profile": "http://1nathanliang.github.io",
      "contributions": [
        "bug"
      ]
    }
  ],
  "contributorsPerLine": 7,
  "projectName": "bids-starter-kit",
  "projectOwner": "bids-standard",
  "repoType": "github",
  "repoHost": "https://github.com",
  "skipCi": true
}


================================================
FILE: .github/workflows/deploy_book.yml
================================================
---
name: deploy-book

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

# Only run this when the master branch changes

on:
  push:
    branches:
    - main

# This job installs dependencies, build the book, and pushes it to `gh-pages`

jobs:
  deploy-book:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
      with:
        submodules: recursive
        fetch-depth: 0

    # Install dependencies
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: '3.12'
    - name: Install dependencies
      run: pip install jupyter-book sphinx-reredirects

    # Build the book
    - name: Build the book
      run: make book

    # Push the book's HTML to github-pages
    - name: GitHub Pages action
      uses: peaceiris/actions-gh-pages@v4.0.0
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: src/_build/html


================================================
FILE: .gitignore
================================================
.vscode/

.DS_Store

src/_build

desktop.ini

.idea/

# -----------------------------------------------------------------------------#

## template MATLAB gitignore from
# https://github.com/github/gitignore/blob/main/Global/MATLAB.gitignore

# Windows default autosave extension
*.asv

# OSX / *nix default autosave extension
*.m~

# Compiled MEX binaries (all platforms)
*.mex*

# Packaged app and toolbox files
*.mlappinstall
*.mltbx

# Generated helpsearch folders
helpsearch*/

# Simulink code generation folders
slprj/
sccprj/

# Matlab code generation folders
codegen/

# Simulink autosave extension
*.autosave

# Simulink cache files
*.slxc

# Octave session info
octave-workspace

# -----------------------------------------------------------------------------#

## template python gitignore from
# https://github.com/github/gitignore/blob/main/Python.gitignore

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
#   For a library or package, you might want to ignore these files since the code is
#   intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
#Pipfile.lock

# poetry
#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#  and can be added to the global gitignore or merged into this file.  For a more nuclear
#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/


================================================
FILE: LICENSE
================================================
Attribution 4.0 International

=======================================================================

Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.

Using Creative Commons Public Licenses

Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.

     Considerations for licensors: Our public licenses are
     intended for use by those authorized to give the public
     permission to use material in ways otherwise restricted by
     copyright and certain other rights. Our licenses are
     irrevocable. Licensors should read and understand the terms
     and conditions of the license they choose before applying it.
     Licensors should also secure all rights necessary before
     applying our licenses so that the public can reuse the
     material as expected. Licensors should clearly mark any
     material not subject to the license. This includes other CC-
     licensed material, or material used under an exception or
     limitation to copyright. More considerations for licensors:
	wiki.creativecommons.org/Considerations_for_licensors

     Considerations for the public: By using one of our public
     licenses, a licensor grants the public permission to use the
     licensed material under specified terms and conditions. If
     the licensor's permission is not necessary for any reason--for
     example, because of any applicable exception or limitation to
     copyright--then that use is not regulated by the license. Our
     licenses grant only permissions under copyright and certain
     other rights that a licensor has authority to grant. Use of
     the licensed material may still be restricted for other
     reasons, including because others have copyright or other
     rights in the material. A licensor may make special requests,
     such as asking that all changes be marked or described.
     Although not required by our licenses, you are encouraged to
     respect those requests where reasonable. More_considerations
     for the public:
	wiki.creativecommons.org/Considerations_for_licensees

=======================================================================

Creative Commons Attribution 4.0 International Public License

By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.


Section 1 -- Definitions.

  a. Adapted Material means material subject to Copyright and Similar
     Rights that is derived from or based upon the Licensed Material
     and in which the Licensed Material is translated, altered,
     arranged, transformed, or otherwise modified in a manner requiring
     permission under the Copyright and Similar Rights held by the
     Licensor. For purposes of this Public License, where the Licensed
     Material is a musical work, performance, or sound recording,
     Adapted Material is always produced where the Licensed Material is
     synched in timed relation with a moving image.

  b. Adapter's License means the license You apply to Your Copyright
     and Similar Rights in Your contributions to Adapted Material in
     accordance with the terms and conditions of this Public License.

  c. Copyright and Similar Rights means copyright and/or similar rights
     closely related to copyright including, without limitation,
     performance, broadcast, sound recording, and Sui Generis Database
     Rights, without regard to how the rights are labeled or
     categorized. For purposes of this Public License, the rights
     specified in Section 2(b)(1)-(2) are not Copyright and Similar
     Rights.

  d. Effective Technological Measures means those measures that, in the
     absence of proper authority, may not be circumvented under laws
     fulfilling obligations under Article 11 of the WIPO Copyright
     Treaty adopted on December 20, 1996, and/or similar international
     agreements.

  e. Exceptions and Limitations means fair use, fair dealing, and/or
     any other exception or limitation to Copyright and Similar Rights
     that applies to Your use of the Licensed Material.

  f. Licensed Material means the artistic or literary work, database,
     or other material to which the Licensor applied this Public
     License.

  g. Licensed Rights means the rights granted to You subject to the
     terms and conditions of this Public License, which are limited to
     all Copyright and Similar Rights that apply to Your use of the
     Licensed Material and that the Licensor has authority to license.

  h. Licensor means the individual(s) or entity(ies) granting rights
     under this Public License.

  i. Share means to provide material to the public by any means or
     process that requires permission under the Licensed Rights, such
     as reproduction, public display, public performance, distribution,
     dissemination, communication, or importation, and to make material
     available to the public including in ways that members of the
     public may access the material from a place and at a time
     individually chosen by them.

  j. Sui Generis Database Rights means rights other than copyright
     resulting from Directive 96/9/EC of the European Parliament and of
     the Council of 11 March 1996 on the legal protection of databases,
     as amended and/or succeeded, as well as other essentially
     equivalent rights anywhere in the world.

  k. You means the individual or entity exercising the Licensed Rights
     under this Public License. Your has a corresponding meaning.


Section 2 -- Scope.

  a. License grant.

       1. Subject to the terms and conditions of this Public License,
          the Licensor hereby grants You a worldwide, royalty-free,
          non-sublicensable, non-exclusive, irrevocable license to
          exercise the Licensed Rights in the Licensed Material to:

            a. reproduce and Share the Licensed Material, in whole or
               in part; and

            b. produce, reproduce, and Share Adapted Material.

       2. Exceptions and Limitations. For the avoidance of doubt, where
          Exceptions and Limitations apply to Your use, this Public
          License does not apply, and You do not need to comply with
          its terms and conditions.

       3. Term. The term of this Public License is specified in Section
          6(a).

       4. Media and formats; technical modifications allowed. The
          Licensor authorizes You to exercise the Licensed Rights in
          all media and formats whether now known or hereafter created,
          and to make technical modifications necessary to do so. The
          Licensor waives and/or agrees not to assert any right or
          authority to forbid You from making technical modifications
          necessary to exercise the Licensed Rights, including
          technical modifications necessary to circumvent Effective
          Technological Measures. For purposes of this Public License,
          simply making modifications authorized by this Section 2(a)
          (4) never produces Adapted Material.

       5. Downstream recipients.

            a. Offer from the Licensor -- Licensed Material. Every
               recipient of the Licensed Material automatically
               receives an offer from the Licensor to exercise the
               Licensed Rights under the terms and conditions of this
               Public License.

            b. No downstream restrictions. You may not offer or impose
               any additional or different terms or conditions on, or
               apply any Effective Technological Measures to, the
               Licensed Material if doing so restricts exercise of the
               Licensed Rights by any recipient of the Licensed
               Material.

       6. No endorsement. Nothing in this Public License constitutes or
          may be construed as permission to assert or imply that You
          are, or that Your use of the Licensed Material is, connected
          with, or sponsored, endorsed, or granted official status by,
          the Licensor or others designated to receive attribution as
          provided in Section 3(a)(1)(A)(i).

  b. Other rights.

       1. Moral rights, such as the right of integrity, are not
          licensed under this Public License, nor are publicity,
          privacy, and/or other similar personality rights; however, to
          the extent possible, the Licensor waives and/or agrees not to
          assert any such rights held by the Licensor to the limited
          extent necessary to allow You to exercise the Licensed
          Rights, but not otherwise.

       2. Patent and trademark rights are not licensed under this
          Public License.

       3. To the extent possible, the Licensor waives any right to
          collect royalties from You for the exercise of the Licensed
          Rights, whether directly or through a collecting society
          under any voluntary or waivable statutory or compulsory
          licensing scheme. In all other cases the Licensor expressly
          reserves any right to collect such royalties.


Section 3 -- License Conditions.

Your exercise of the Licensed Rights is expressly made subject to the
following conditions.

  a. Attribution.

       1. If You Share the Licensed Material (including in modified
          form), You must:

            a. retain the following if it is supplied by the Licensor
               with the Licensed Material:

                 i. identification of the creator(s) of the Licensed
                    Material and any others designated to receive
                    attribution, in any reasonable manner requested by
                    the Licensor (including by pseudonym if
                    designated);

                ii. a copyright notice;

               iii. a notice that refers to this Public License;

                iv. a notice that refers to the disclaimer of
                    warranties;

                 v. a URI or hyperlink to the Licensed Material to the
                    extent reasonably practicable;

            b. indicate if You modified the Licensed Material and
               retain an indication of any previous modifications; and

            c. indicate the Licensed Material is licensed under this
               Public License, and include the text of, or the URI or
               hyperlink to, this Public License.

       2. You may satisfy the conditions in Section 3(a)(1) in any
          reasonable manner based on the medium, means, and context in
          which You Share the Licensed Material. For example, it may be
          reasonable to satisfy the conditions by providing a URI or
          hyperlink to a resource that includes the required
          information.

       3. If requested by the Licensor, You must remove any of the
          information required by Section 3(a)(1)(A) to the extent
          reasonably practicable.

       4. If You Share Adapted Material You produce, the Adapter's
          License You apply must not prevent recipients of the Adapted
          Material from complying with this Public License.


Section 4 -- Sui Generis Database Rights.

Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:

  a. for the avoidance of doubt, Section 2(a)(1) grants You the right
     to extract, reuse, reproduce, and Share all or a substantial
     portion of the contents of the database;

  b. if You include all or a substantial portion of the database
     contents in a database in which You have Sui Generis Database
     Rights, then the database in which You have Sui Generis Database
     Rights (but not its individual contents) is Adapted Material; and

  c. You must comply with the conditions in Section 3(a) if You Share
     all or a substantial portion of the contents of the database.

For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.


Section 5 -- Disclaimer of Warranties and Limitation of Liability.

  a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
     EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
     AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
     ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
     IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
     WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
     PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
     ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
     KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
     ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

  b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
     TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
     NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
     INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
     COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
     USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
     ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
     DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
     IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

  c. The disclaimer of warranties and limitation of liability provided
     above shall be interpreted in a manner that, to the extent
     possible, most closely approximates an absolute disclaimer and
     waiver of all liability.


Section 6 -- Term and Termination.

  a. This Public License applies for the term of the Copyright and
     Similar Rights licensed here. However, if You fail to comply with
     this Public License, then Your rights under this Public License
     terminate automatically.

  b. Where Your right to use the Licensed Material has terminated under
     Section 6(a), it reinstates:

       1. automatically as of the date the violation is cured, provided
          it is cured within 30 days of Your discovery of the
          violation; or

       2. upon express reinstatement by the Licensor.

     For the avoidance of doubt, this Section 6(b) does not affect any
     right the Licensor may have to seek remedies for Your violations
     of this Public License.

  c. For the avoidance of doubt, the Licensor may also offer the
     Licensed Material under separate terms or conditions or stop
     distributing the Licensed Material at any time; however, doing so
     will not terminate this Public License.

  d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
     License.


Section 7 -- Other Terms and Conditions.

  a. The Licensor shall not be bound by any additional or different
     terms or conditions communicated by You unless expressly agreed.

  b. Any arrangements, understandings, or agreements regarding the
     Licensed Material not stated herein are separate from and
     independent of the terms and conditions of this Public License.


Section 8 -- Interpretation.

  a. For the avoidance of doubt, this Public License does not, and
     shall not be interpreted to, reduce, limit, restrict, or impose
     conditions on any use of the Licensed Material that could lawfully
     be made without permission under this Public License.

  b. To the extent possible, if any provision of this Public License is
     deemed unenforceable, it shall be automatically reformed to the
     minimum extent necessary to make it enforceable. If the provision
     cannot be reformed, it shall be severed from this Public License
     without affecting the enforceability of the remaining terms and
     conditions.

  c. No term or condition of this Public License will be waived and no
     failure to comply consented to unless expressly agreed to by the
     Licensor.

  d. Nothing in this Public License constitutes or may be interpreted
     as a limitation upon, or waiver of, any privileges and immunities
     that apply to the Licensor or You, including from the legal
     processes of any jurisdiction or authority.


=======================================================================

Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.

Creative Commons may be contacted at creativecommons.org.


================================================
FILE: Makefile
================================================
.PHONY: all clean

define BROWSER_PYSCRIPT
import os, webbrowser, sys

from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
	match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
	if match:
		target, help = match.groups()
		print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"

# Put it first so that "make" without argument is like "make help".
help:
	@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean:
	rm -fr src/_build/

book: clean ## build the book
	jupyter-book build src

view: book ## view the book
	$(BROWSER) $$PWD/src/_build/html/index.html

test: ## build the book and tests the links
	jupyter-book build src --builder linkcheck


================================================
FILE: README.md
================================================
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-43-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

# The Starter-kit has moved to the <a href="https://bids.neuroimaging.io/getting_started/" target="_blank">new BIDS website</a>.

## Contributors ✨

Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tr>
    <td align="center"><a href="https://github.com/dorahermes"><img src="https://avatars1.githubusercontent.com/u/4977351?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dora Hermes</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=dorahermes" title="Code">💻</a> <a href="#content-dorahermes" title="Content">🖋</a> <a href="#ideas-dorahermes" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Adorahermes" title="Reviewed Pull Requests">👀</a> <a href="#maintenance-dorahermes" title="Maintenance">🚧</a> <a href="https://github.com/bids-standard/bids-starter-kit/commits?author=dorahermes" title="Documentation">📖</a></td>
    <td align="center"><a href="http://chrisgorgolewski.org"><img src="https://avatars2.githubusercontent.com/u/238759?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Gorgolewski</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Achrisgorgo" title="Reviewed Pull Requests">👀</a> <a href="#maintenance-chrisgorgo" title="Maintenance">🚧</a> <a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3Achrisgorgo" title="Bug reports">🐛</a></td>
    <td align="center"><a href="http://chrisholdgraf.com"><img src="https://avatars1.githubusercontent.com/u/1839645?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Holdgraf</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Acholdgraf" title="Reviewed Pull Requests">👀</a> <a href="#content-choldgraf" title="Content">🖋</a> <a href="#maintenance-choldgraf" title="Maintenance">🚧</a></td>
    <td align="center"><a href="https://chrisgahnstrom.wordpress.com/"><img src="https://avatars1.githubusercontent.com/u/12600386?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Gahnström</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=cofficer" title="Code">💻</a> <a href="#content-cofficer" title="Content">🖋</a> <a href="#ideas-cofficer" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="http://emdupre.me"><img src="https://avatars3.githubusercontent.com/u/15017191?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Elizabeth DuPre</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Aemdupre" title="Reviewed Pull Requests">👀</a> <a href="#maintenance-emdupre" title="Maintenance">🚧</a> <a href="#ideas-emdupre" title="Ideas, Planning, & Feedback">🤔</a> <a href="#content-emdupre" title="Content">🖋</a> <a href="https://github.com/bids-standard/bids-starter-kit/commits?author=emdupre" title="Documentation">📖</a></td>
    <td align="center"><a href="https://github.com/anushkab"><img src="https://avatars0.githubusercontent.com/u/20943511?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Utmost Happiness</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=anushkab" title="Code">💻</a> <a href="#content-anushkab" title="Content">🖋</a> <a href="#ideas-anushkab" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://whitakerlab.github.io"><img src="https://avatars1.githubusercontent.com/u/3626306?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kirstie Whitaker</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3AKirstieJane" title="Reviewed Pull Requests">👀</a> <a href="#ideas-KirstieJane" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-KirstieJane" title="Maintenance">🚧</a> <a href="#content-KirstieJane" title="Content">🖋</a> <a href="https://github.com/bids-standard/bids-starter-kit/commits?author=KirstieJane" title="Documentation">📖</a> <a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3AKirstieJane" title="Bug reports">🐛</a></td>
  </tr>
  <tr>
    <td align="center"><a href="https://github.com/Park-Patrick"><img src="https://avatars3.githubusercontent.com/u/12662110?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Patrick Park</b></sub></a><br /><a href="#ideas-Park-Patrick" title="Ideas, Planning, & Feedback">🤔</a> <a href="#content-Park-Patrick" title="Content">🖋</a> <a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3APark-Patrick" title="Reviewed Pull Requests">👀</a></td>
    <td align="center"><a href="http://peerherholz.github.io"><img src="https://avatars0.githubusercontent.com/u/20129524?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Peer Herholz</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=PeerHerholz" title="Code">💻</a></td>
    <td align="center"><a href="http://www.sbirc.ed.ac.uk/cyril/"><img src="https://avatars2.githubusercontent.com/u/4772878?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cyril Pernet</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=CPernet" title="Code">💻</a></td>
    <td align="center"><a href="https://www.stefanappelhoff.com"><img src="https://avatars1.githubusercontent.com/u/9084751?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stefan Appelhoff</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Asappelhoff" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/bids-standard/bids-starter-kit/commits?author=sappelhoff" title="Code">💻</a> <a href="#content-sappelhoff" title="Content">🖋</a> <a href="#ideas-sappelhoff" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://ilkayisik.github.io"><img src="https://avatars1.githubusercontent.com/u/22478219?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ilkay Isik</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3Ailkayisik" title="Bug reports">🐛</a></td>
    <td align="center"><a href="https://teonbrooks.com"><img src="https://avatars1.githubusercontent.com/u/1578674?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Teon L Brooks</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3Ateonbrooks" title="Bug reports">🐛</a></td>
    <td align="center"><a href="https://github.com/bayab"><img src="https://avatars0.githubusercontent.com/u/16117420?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ayab</b></sub></a><br /><a href="#content-bayab" title="Content">🖋</a></td>
  </tr>
  <tr>
    <td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars3.githubusercontent.com/u/6961185?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="#content-Remi-Gau" title="Content">🖋</a></td>
    <td align="center"><a href="https://github.com/JaapVanDerAar"><img src="https://avatars3.githubusercontent.com/u/32334327?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jaap van der Aar</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=JaapVanDerAar" title="Code">💻</a> <a href="#content-JaapVanDerAar" title="Content">🖋</a> <a href="#ideas-JaapVanDerAar" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://github.com/GiulioCastegnaro"><img src="https://avatars2.githubusercontent.com/u/45361920?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Giulio Castegnaro</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=GiulioCastegnaro" title="Code">💻</a> <a href="#content-GiulioCastegnaro" title="Content">🖋</a> <a href="#ideas-GiulioCastegnaro" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://github.com/franklin-feingold"><img src="https://avatars1.githubusercontent.com/u/35307458?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Franklin Feingold</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3Afranklin-feingold" title="Bug reports">🐛</a> <a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Afranklin-feingold" title="Reviewed Pull Requests">👀</a></td>
    <td align="center"><a href="http://www.nisox.org"><img src="https://avatars3.githubusercontent.com/u/5155907?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Thomas Nichols</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Anicholst" title="Reviewed Pull Requests">👀</a></td>
    <td align="center"><a href="https://github.com/pvdemael"><img src="https://avatars1.githubusercontent.com/u/37624277?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pieter Vandemaele</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3Apvdemael" title="Bug reports">🐛</a></td>
    <td align="center"><a href="https://github.com/gllmflndn"><img src="https://avatars0.githubusercontent.com/u/5950855?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Guillaume Flandin</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Agllmflndn" title="Reviewed Pull Requests">👀</a> <a href="#ideas-gllmflndn" title="Ideas, Planning, & Feedback">🤔</a></td>
  </tr>
  <tr>
    <td align="center"><a href="https://github.com/robertoostenveld"><img src="https://avatars1.githubusercontent.com/u/899043?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Robert Oostenveld</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3Arobertoostenveld" title="Bug reports">🐛</a> <a href="https://github.com/bids-standard/bids-starter-kit/pulls?q=is%3Apr+reviewed-by%3Arobertoostenveld" title="Reviewed Pull Requests">👀</a> <a href="#ideas-robertoostenveld" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://github.com/HappyFacade"><img src="https://avatars0.githubusercontent.com/u/54226355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Happy</b></sub></a><br /><a href="#content-HappyFacade" title="Content">🖋</a></td>
    <td align="center"><a href="https://www.linkedin.com/in/tal-pal-attia-201373b0/"><img src="https://avatars1.githubusercontent.com/u/24300712?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tal Pal Attia</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=tpatpa" title="Code">💻</a></td>
    <td align="center"><a href="https://github.com/VisLab"><img src="https://avatars1.githubusercontent.com/u/1189050?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kay Robbins</b></sub></a><br /><a href="#ideas-VisLab" title="Ideas, Planning, & Feedback">🤔</a> <a href="#content-VisLab" title="Content">🖋</a></td>
    <td align="center"><a href="https://erasmus-synclab.nl/"><img src="https://avatars1.githubusercontent.com/u/41283173?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Eduard Klapwijk</b></sub></a><br /><a href="#ideas-eduardklap" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://github.com/DorienHuijser"><img src="https://avatars1.githubusercontent.com/u/58177697?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dorien Huijser</b></sub></a><br /><a href="#ideas-DorienHuijser" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="http://cmn.nimh.nih.gov/dsst"><img src="https://avatars1.githubusercontent.com/u/10297203?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Arshitha Basavaraj</b></sub></a><br /><a href="#ideas-Arshitha" title="Ideas, Planning, & Feedback">🤔</a></td>
  </tr>
  <tr>
    <td align="center"><a href="https://lennartwittkuhn.com"><img src="https://avatars0.githubusercontent.com/u/42233065?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lennart Wittkuhn</b></sub></a><br /><a href="#ideas-lnnrtwttkhn" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://github.com/bendhouseart"><img src="https://avatars.githubusercontent.com/u/28850131?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Anthony Galassi</b></sub></a><br /><a href="#ideas-bendhouseart" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/bids-standard/bids-starter-kit/commits?author=bendhouseart" title="Code">💻</a></td>
    <td align="center"><a href="http://DrMowinckels.io"><img src="https://avatars.githubusercontent.com/u/14014329?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Athanasia Monika Mowinckel</b></sub></a><br /><a href="#ideas-Athanasiamo" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/bids-standard/bids-starter-kit/commits?author=Athanasiamo" title="Code">💻</a></td>
    <td align="center"><a href="https://github.com/yonestar"><img src="https://avatars.githubusercontent.com/u/4513934?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yoni Ashar</b></sub></a><br /><a href="#ideas-yonestar" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://github.com/dkp"><img src="https://avatars.githubusercontent.com/u/965184?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dkp</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3Adkp" title="Bug reports">🐛</a></td>
    <td align="center"><a href="https://jdkent.github.io/"><img src="https://avatars.githubusercontent.com/u/12564882?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James Kent</b></sub></a><br /><a href="#ideas-jdkent" title="Ideas, Planning, & Feedback">🤔</a></td>
    <td align="center"><a href="https://github.com/cfxb"><img src="https://avatars.githubusercontent.com/u/39246257?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Benjamin</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=cfxb" title="Documentation">📖</a></td>
  </tr>
  <tr>
    <td align="center"><a href="http://isla.st"><img src="https://avatars.githubusercontent.com/u/23707851?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Isla</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=Islast" title="Documentation">📖</a></td>
    <td align="center"><a href="https://github.com/effigies"><img src="https://avatars.githubusercontent.com/u/83442?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Markiewicz</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=effigies" title="Documentation">📖</a></td>
    <td align="center"><a href="https://ankiitgupta7.github.io/"><img src="https://avatars.githubusercontent.com/u/25341569?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ankit Gupta</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=ankiitgupta7" title="Documentation">📖</a></td>
    <td align="center"><a href="https://github.com/alexvonlautz"><img src="https://avatars.githubusercontent.com/u/44004062?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alex von Lautz</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=alexvonlautz" title="Documentation">📖</a></td>
    <td align="center"><a href="https://github.com/AlexandreHutton"><img src="https://avatars.githubusercontent.com/u/50920802?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alexandre Hutton</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/commits?author=AlexandreHutton" title="Documentation">📖</a></td>
    <td align="center"><a href="http://Abrren_Chen"><img src="https://avatars.githubusercontent.com/u/54808990?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Abrren Chen</b></sub></a><br /><a href="#maintenance-AbrrenC" title="Maintenance">🚧</a></td>
    <td align="center"><a href="http://gabrielabs.com"><img src="https://avatars.githubusercontent.com/u/21208915?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gabriel Silveira</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3AGabomfim" title="Bug reports">🐛</a> <a href="https://github.com/bids-standard/bids-starter-kit/commits?author=Gabomfim" title="Code">💻</a></td>
  </tr>
  <tr>
    <td align="center"><a href="http://1nathanliang.github.io"><img src="https://avatars.githubusercontent.com/u/36468637?v=4?s=100" width="100px;" alt=""/><br /><sub><b>nathan liang</b></sub></a><br /><a href="https://github.com/bids-standard/bids-starter-kit/issues?q=author%3A1nathanliang" title="Bug reports">🐛</a></td>
  </tr>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the
[all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!


================================================
FILE: interactiveTreeVisualization/epilepsyClassification2017/tree.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">

    <title>ILAE classification of the epilepsies Tree</title>

    <link rel="stylesheet" href="./treeStyle.css">

</head>

<header>
    <h1 align="center">ILAE classification of the epilepsies Tree</h1>

    <p align="center">Scheffer, I. E., Berkovic, S., Capovilla, G., Connolly, M. B., French, J., Guilhoto, L., ... &
        Nordli, D. R. (2017). ILAE classification of the epilepsies: position paper of the ILAE Commission for
        Classification and Terminology. Epilepsia, 58(4), 512-521.</p>

    <p align="center">
        <button class="button" onclick="expandAll()">Expand All</button>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <button class="button" onclick="collapseAll()">Collapse All</button>
    </p>
</header>

<body>

    <!-- load the d3.js library -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script>

    <!-- load tree data -->
    <script src="./treeData.js"></script>

    <!-- load tree functions -->
    <script src="./treeFunctions.js"></script>


</body>

<footer>
</footer>

</html>

<!--
    References:

    Scheffer, I. E., Berkovic, S., Capovilla, G., Connolly, M. B., French, J., Guilhoto, L., ... & Nordli, D. R. (2017). ILAE classification of the epilepsies: position paper of the ILAE Commission for Classification and Terminology. Epilepsia, 58(4), 512-521.
        https://onlinelibrary.wiley.com/doi/full/10.1111/epi.13709

    Simple d3.js tree diagram -
        https://bl.ocks.org/d3noob/8323795

    Interactive d3.js tree diagram -
        https://bl.ocks.org/d3noob/8375092

    Export SVG D3 visualization to PNG or JPEG -
        http://bl.ocks.org/Rokotyan/0556f8facbaf344507cdc45dc3622177

    d3-hierarchy -
        https://github.com/d3/d3-hierarchy/blob/v1.1.8/README.md#tree



-->


================================================
FILE: interactiveTreeVisualization/epilepsyClassification2017/treeData.js
================================================
var treeData = [{
    "name": "Epilepsy Classification",
    "parent": "null",
    "_children": [

        // ****** Seizure Type ******

        {
            "name": "Seizure Type",
            "parent": "Epilepsy Classification",
            "_children": [

                // *** Generalised ***
                {
                    "name": "Generalised",
                    "parent": "Seizure Type",
                    "_children": [{
                            "name": "Motor",
                            "parent": "Generalised",
                            "_children": [{
                                    "name": "Generalized tonic-clonic and variants",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Generalized tonic",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Generalized atonic",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Myoclonic",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Myoclonic-atonic",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Epileptic spasms",
                                    "parent": "Motor"
                                }
                            ]
                        },
                        {
                            "name": "Non-motor",
                            "parent": "Generalised",
                            "_children": [{
                                "name": "Typical Absence",
                                "parent": "Non-motor"
                            }, {
                                "name": "Atypical Absence",
                                "parent": "Non-motor"
                            }, {
                                "name": "Myoclonic absence",
                                "parent": "Non-motor"
                            }, {
                                "name": "Absence with eyelid myoclonia",
                                "parent": "Non-motor"
                            }]
                        }
                    ]
                },

                // *** Focal ***
                {
                    "name": "Focal",
                    "parent": "Seizure Type",
                    "_children": [{
                            "name": "Awareness",
                            "parent": "Focal",
                            "_children": [{
                                "name": "Aware",
                                "parent": "Awareness",
                            }, {
                                "name": "Impaired Awareness",
                                "parent": "Awareness",
                            }]
                        },
                        {
                            "name": "Motor",
                            "parent": "Focal",
                            "_children": [{
                                    "name": "Focal clonic seizure",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal tonic seizure",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal motor seizure with dystonia",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal myoclonic seizure",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal atonic seizure",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal motor seizure with paresis/paralysis",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal epileptic spasms",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal hyperkinetic seizure",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal automatism seizure",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal motor seizure with dysarthria / anarthria",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal motor seizure with negative myoclonus",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal motor seizure with version",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Focal bilateral motor seizure",
                                    "parent": "Motor"
                                }
                            ]
                        },
                        {
                            "name": "Non-motor",
                            "parent": "Focal",
                            "_children": [{
                                    "name": "Focal sensory seizure",
                                    "parent": "Non-motor",
                                    "_children": [{
                                        "name": "Focal somatosensory seizure",
                                        "parent": "Focal sensory seizure"
                                    }, {
                                        "name": "Focal sensory visual seizure",
                                        "parent": "Focal sensory seizure"
                                    }, {
                                        "name": "Focal sensory auditory seizure",
                                        "parent": "Focal sensory seizure"
                                    }, {
                                        "name": "Focal sensory olfactory seizure",
                                        "parent": "Focal sensory seizure"
                                    }, {
                                        "name": "Focal sensory gustatory seizure",
                                        "parent": "Focal sensory seizure"
                                    }, {
                                        "name": "Focal sensory vestibular seizure",
                                        "parent": "Focal sensory seizure"
                                    }, {
                                        "name": "Focal sensory seizure with hot-cold sensations",
                                        "parent": "Focal sensory seizure"
                                    }, {
                                        "name": "Focal sensory seizure with cephalic sensation",
                                        "parent": "Focal sensory seizure"
                                    }]
                                },
                                {
                                    "name": "Focal cognitive seizure",
                                    "parent": "Non-motor",
                                    "_children": [{
                                        "name": "Focal cognitive seizure with expressive dysphasia / aphasia",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with anomia",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with receptive dysphasia / aphasia",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with auditory agnosia",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with conduction dysphasia / aphasia",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with dyslexia / alexia",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with memory impairment",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with deja vu / jamais vu",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with hallucination",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with illusion",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with dissociation",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with forced thinking",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with dyscalculia / acalculia",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with dysgraphia/agraphia",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with left-right confusion",
                                        "parent": "Focal cognitive seizure"
                                    }, {
                                        "name": "Focal cognitive seizure with neglect",
                                        "parent": "Focal cognitive seizure"
                                    }]
                                },
                                {
                                    "name": "Focal emotional seizure",
                                    "parent": "Non-motor",
                                    "_children": [{
                                        "name": "Focal emotional seizure with fear/anxiety/panic",
                                        "parent": "Focal emotional seizure"
                                    }, {
                                        "name": "Focal emotional seizure with laughing (gelastic)",
                                        "parent": "Focal emotional seizure"
                                    }, {
                                        "name": "Focal emotional seizure with crying (dacrystic)",
                                        "parent": "Focal emotional seizure"
                                    }, {
                                        "name": "Focal emotional seizure with pleasure",
                                        "parent": "Focal emotional seizure"
                                    }, {
                                        "name": "Focal emotional seizure with anger",
                                        "parent": "Focal emotional seizure"
                                    }]
                                },
                                {
                                    "name": "Focal autonomic seizure",
                                    "parent": "Non-motor",
                                    "_children": [{
                                        "name": "Focal autonomic seizure with palpitations / tachycardia / bradycardia / asystole",
                                        "parent": "Focal autonomic seizure"
                                    }, {
                                        "name": "Focal autonomic seizure with epigastric sensation",
                                        "parent": "Focal autonomic seizure"
                                    }, {
                                        "name": "Focal autonomic seizure with pallor / flushing",
                                        "parent": "Focal autonomic seizure"
                                    }, {
                                        "name": "Focal autonomic seizure with hypoventilation / hyperventilation / altered respiration",
                                        "parent": "Focal autonomic seizure"
                                    }, {
                                        "name": "Focal autonomic seizure with piloerection",
                                        "parent": "Focal autonomic seizure"
                                    }, {
                                        "name": "Focal autonomic seizure with erection",
                                        "parent": "Focal autonomic seizure"
                                    }, {
                                        "name": "Focal autonomic seizure with urge to urinate / defecate",
                                        "parent": "Focal autonomic seizure"
                                    }, {
                                        "name": "Focal autonomic seizure with lacrimation",
                                        "parent": "Focal autonomic seizure"
                                    }, {
                                        "name": "Focal autonomic seizure with pupillary dilation / constriction",
                                        "parent": "Focal autonomic seizure"
                                    }]
                                },
                                {
                                    "name": "Focal behavioural arrest seizure",
                                    "parent": "Non-motor",
                                    "_children": [{
                                        "name": "Focal behavioural arrest seizure",
                                        "parent": "Focal behavioural arrest seizure"
                                    }]
                                }
                            ]
                        },
                        {
                            "name": "Focal to bilateral tonic-clonic seizure",
                            "parent": "Focal",
                            "_children": [{
                                "name": "Focal to bilateral tonic-clonic seizure",
                                "parent": "Focal to bilateral tonic-clonic seizure"
                            }]
                        }
                    ]
                },

                // *** Unknown ***
                {
                    "name": "Unknown",
                    "parent": "Seizure Type",
                    "_children": [{
                            "name": "Motor",
                            "parent": "Focal",
                            "_children": [{
                                    "name": "Tonic–clonic",
                                    "parent": "Motor"
                                },
                                {
                                    "name": "Epileptic spasms",
                                    "parent": "Motor"
                                }
                            ]
                        },
                        {
                            "name": "Non-motor",
                            "parent": "Focal",
                            "_children": [{
                                "name": "Behaviour arrest",
                                "parent": "Non-motor"
                            }, {
                                "name": "Unclassified",
                                "parent": "Non-motor"
                            }]
                        }
                    ]
                }
            ]
        },

        // ****** Epilepsy Type ******

        {
            "name": "Epilepsy Type",
            "parent": "Epilepsy Classification",
            "_children": [{
                "name": "Generalised Epilepsy",
                "parent": "Epilepsy Type"
            }, {
                "name": "Focal Epilepsy",
                "parent": "Epilepsy Type"
            }, {
                "name": "Combined generalised and focal Epilepsy",
                "parent": "Epilepsy Type"
            }, {
                "name": "Unknown Epilepsy",
                "parent": "Epilepsy Type"
            }]
        },

        // ****** Epilepsy Syndrome ******

        {
            "name": "Epilepsy Syndrome",
            "parent": "Epilepsy Classification",
            "_children": [{
                "name": "Neonatal/Infantile",
                "parent": "Epilepsy Syndrome",
                "_children": [{
                    "name": "Self-limited neonatal seizures and Self-limited familial neonatal epilepsy",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "Self limited familial and non-familial infantile epilepsy",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "Early myoclonic encephalopathy",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "Ohtahara syndrome",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "West syndrome",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "Dravet syndrome",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "Myoclonic epilepsy in infancy",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "Epilepsy of infancy with migrating focal seizures",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "Myoclonic encephalopathy in non-progressive disorders",
                    "parent": "Neonatal/Infantile"
                }, {
                    "name": "Febrile seizures plus, genetic epilepsy with febrile seizures plus",
                    "parent": "Neonatal/Infantile"
                }]
            }, {
                "name": "Childhood",
                "parent": "Epilepsy Syndrome",
                "_children": [{
                    "name": "Epilepsy with myoclonic-atonic seizures",
                    "parent": "Childhood"
                }, {
                    "name": "Epilepsy with eyelid myoclonias",
                    "parent": "Childhood"
                }, {
                    "name": "Lennox-Gastaut syndrome",
                    "parent": "Childhood"
                }, {
                    "name": "Childhood absence epilepsy",
                    "parent": "Childhood"
                }, {
                    "name": "Epilepsy with myoclonic absences",
                    "parent": "Childhood"
                }, {
                    "name": "Panayiotopoulos syndrome",
                    "parent": "Childhood"
                }, {
                    "name": "Childhood occipital epilepsy (Gastaut type)",
                    "parent": "Childhood"
                }, {
                    "name": "Photosensitive occipital lobe epilepsy",
                    "parent": "Childhood"
                }, {
                    "name": "Childhood epilepsy with centrotemporal spikes",
                    "parent": "Childhood"
                }, {
                    "name": "Atypical childhood epilepsy with centrotemporal spikes",
                    "parent": "Childhood"
                }, {
                    "name": "Epileptic encephalopathy with continuous spike-and-wave during sleep",
                    "parent": "Childhood"
                }, {
                    "name": "Landau-Kleffner syndrome",
                    "parent": "Childhood"
                }, {
                    "name": "Autosomal dominant nocturnal frontal lobe epilepsy",
                    "parent": "Childhood"
                }]
            }, {
                "name": "Adolescent/Adult",
                "parent": "Epilepsy Syndrome",
                "_children": [{
                    "name": "Juvenile absence epilepsy",
                    "parent": "Adolescent/Adult"
                }, {
                    "name": "Juvenile myoclonic epilepsy",
                    "parent": "Adolescent/Adult"
                }, {
                    "name": "Epilepsy with generalized tonic-clonic seizures alone",
                    "parent": "Adolescent/Adult"
                }, {
                    "name": "Autosomal dominant epilepsy with auditory features",
                    "parent": "Adolescent/Adult"
                }, {
                    "name": "Other familial temporal lobe epilepsies",
                    "parent": "Adolescent/Adult"
                }]
            }, {
                "name": "Any Age",
                "parent": "Epilepsy Syndrome",
                "_children": [{
                        "name": "Familial focal epilepsy with variable foci",
                        "parent": "Any Age"
                    },
                    {
                        "name": "Reflex epilepsies",
                        "parent": "Any Age"
                    }, {
                        "name": "Progressive myoclonus epilepsies",
                        "parent": "Any Age"
                    }
                ]
            }]
        },

        // ****** Etiology ******

        {
            "name": "Etiology",
            "parent": "Epilepsy Classification",
            "_children": [{
                "name": "Genetic Etiology",
                "parent": "Etiology",
                "_children": [{
                    "name": "Chromosomal abnormalities",
                    "parent": "Genetic Etiology"
                }, {
                    "name": "Gene abnormalities",
                    "parent": "Genetic Etiology"
                }]
            }, {
                "name": "Structural Etiology",
                "parent": "Etiology",
                "_children": [{
                    "name": "Malformations of cortical development",
                    "parent": "Structural Etiology"
                }, {
                    "name": "Vascular malformations",
                    "parent": "Structural Etiology"
                }, {
                    "name": "Hippocampal sclerosis",
                    "parent": "Structural Etiology"
                }, {
                    "name": "Hypoxic-ischemic structural abnormalities",
                    "parent": "Structural Etiology"
                }, {
                    "name": "Traumatic Brain Injury",
                    "parent": "Structural Etiology"
                }, {
                    "name": "Tumors",
                    "parent": "Structural Etiology"
                }, {
                    "name": "Porencephalic cyst",
                    "parent": "Structural Etiology"
                }]
            }, {
                "name": "Metabolic Etiology",
                "parent": "Etiology",
                "_children": [{
                    "name": "Biotinidase and holocarboxylase synthase deficiency",
                    "parent": "Metabolic Etiology"
                }, {
                    "name": "Cerebral folate deficiency",
                    "parent": "Metabolic Etiology"
                }, {
                    "name": "Creatine disorders",
                    "parent": "Metabolic Etiology"
                }, {
                    "name": "Folinic acid responsive seizures",
                    "parent": "Metabolic Etiology"
                }, {
                    "name": "Glucose transporter 1 (GLUT1) deficiency",
                    "parent": "Metabolic Etiology"
                }, {
                    "name": "Mitochondrial disorders",
                    "parent": "Metabolic Etiology"
                }, {
                    "name": "Peroxisomal Disorders",
                    "parent": "Metabolic Etiology"
                }, {
                    "name": "Pyridoxine dependent epilepsy/PNPO deficiency",
                    "parent": "Metabolic Etiology"
                }]
            }, {
                "name": "Immune Etiology",
                "parent": "Etiology",
                "_children": [{
                    "name": "Rasmussen syndrome",
                    "parent": "Immune Etiology"
                }, {
                    "name": "Antibody mediated etiologies",
                    "parent": "Immune Etiology"
                }]
            }, {
                "name": "Infectious Etiology",
                "parent": "Etiology",
                "_children": [{
                    "name": "Bacterial Meningitis",
                    "parent": "Infectious Etiology"
                }, {
                    "name": "Cerebral Malaria",
                    "parent": "Infectious Etiology"
                }, {
                    "name": "Cerebral Toxoplasmosis",
                    "parent": "Infectious Etiology"
                }, {
                    "name": "CMV",
                    "parent": "Infectious Etiology"
                }, {
                    "name": "HIV",
                    "parent": "Infectious Etiology"
                }, {
                    "name": "Neurocysticercosis",
                    "parent": "Infectious Etiology"
                }, {
                    "name": "Tuberculosis",
                    "parent": "Infectious Etiology"
                }, {
                    "name": "Viral Encephalitis",
                    "parent": "Infectious Etiology"
                }, {
                    "name": "Other infections",
                    "parent": "Infectious Etiology"
                }]
            }, {
                "name": "Unknown Etiology",
                "parent": "Etiology",
                "_children": [{
                    "name": "Febrile infection related epilepsy syndrome (FIRES)",
                    "parent": "Unknown Etiology"
                }]
            }]
        }
    ]
}];


================================================
FILE: interactiveTreeVisualization/epilepsyClassification2017/treeFunctions.js
================================================
// ************** Generate the tree diagram	 *****************

var margin = {
        top: 50,
        right: 150,
        bottom: 50,
        left: 150
    },
    width = 2 * window.innerWidth - margin.right - margin.left,
    height = 4 * window.innerHeight - margin.top - margin.bottom;

var i = 0,
    duration = 750,
    root;

var tree = d3.layout.tree()
    .separation(function (a, b) {
        if (a.depth > 0) {
            depth = a.depth
        } else {
            depth = 1
        }
        return (a.parent === b.parent ? 2 : 3) / depth;
    })
    .size([height, width]);

//var tree = d3.layout.tree()
//   .size([height, width]);

var diagonal = d3.svg.diagonal()
    .projection(function (d) {
        return [d.y, d.x];
    });

var svg0 = d3.select("body").append("svg")
    .attr("width", width + margin.right + margin.left)
    .attr("height", height + margin.top + margin.bottom)
    .attr("style", "background-color:white")

svg = svg0.append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

root = treeData[0];
root.x0 = height / 2;
root.y0 = 0;

update(root);

d3.select(self.frameElement).style("height", "500px");

// ************** functions to update the tree diagram	 *****************

function update(source) {

    var levelWidth = [1];
    var childCount = function (level, n) {

        if (n.children && n.children.length > 0) {
            if (levelWidth.length <= level + 1) levelWidth.push(0);

            levelWidth[level + 1] += n.children.length;
            n.children.forEach(function (d) {
                childCount(level + 1, d);
            });
        }
    };

    childCount(0, root);
    var newHeight = d3.max(levelWidth) * 50; // 50 pixels per line
    tree = tree.size([newHeight, width]);

    // Compute the new tree layout.
    var nodes = tree.nodes(root).reverse(),
        links = tree.links(nodes);

    // Normalize for fixed-depth.
    nodes.forEach(function (d) {
        d.y = d.depth * 350;
    });

    // Update the nodes…
    var node = svg.selectAll("g.node")
        .data(nodes, function (d) {
            return d.id || (d.id = ++i);
        });

    // Enter any new nodes at the parent's previous position.
    var nodeEnter = node.enter().append("g")
        .attr("class", "node")
        .attr("transform", function (d) {
            return "translate(" + source.y0 + "," + source.x0 + ")";
        })
        .on("click", click);

    nodeEnter.append("circle")
        .attr("r", 1e-6)
        .style("fill", function (d) {
            return d._children ? "lightsteelblue" : "#fff";
        });

    nodeEnter.append("text")
        .attr("x", function (d) {
            return d.children || d._children ? -13 : 13;
        })
        .attr("dy", ".35em")
        .attr("text-anchor", function (d) {
            return d.children || d._children ? "end" : "start";
        })
        .text(function (d) {
            return d.name;
        })
        .style("fill-opacity", 1e-6);

    // Transition nodes to their new position.
    var nodeUpdate = node.transition()
        .duration(duration)
        .attr("transform", function (d) {
            return "translate(" + d.y + "," + d.x + ")";
        });

    nodeUpdate.select("circle")
        .attr("r", 10)
        .style("fill", function (d) {
            return d._children ? "lightsteelblue" : "#fff";
        });

    nodeUpdate.select("text")
        .style("fill-opacity", 1);

    // Transition exiting nodes to the parent's new position.
    var nodeExit = node.exit().transition()
        .duration(duration)
        .attr("transform", function (d) {
            return "translate(" + source.y + "," + source.x + ")";
        })
        .remove();

    nodeExit.select("circle")
        .attr("r", 1e-6);

    nodeExit.select("text")
        .style("fill-opacity", 1e-6);

    // Update the links…
    var link = svg.selectAll("path.link")
        .data(links, function (d) {
            return d.target.id;
        });

    // Enter any new links at the parent's previous position.
    link.enter().insert("path", "g")
        .attr("class", "link")
        .attr("d", function (d) {
            var o = {
                x: source.x0,
                y: source.y0
            };
            return diagonal({
                source: o,
                target: o
            });
        })

    // Transition links to their new position.
    link.transition()
        .duration(duration)
        .attr("d", diagonal);

    // Transition exiting nodes to the parent's new position.
    link.exit().transition()
        .duration(duration)
        .attr("d", function (d) {
            var o = {
                x: source.x,
                y: source.y
            };
            return diagonal({
                source: o,
                target: o
            });
        })
        .remove();

    // Stash the old positions for transition.
    nodes.forEach(function (d) {
        d.x0 = d.x;
        d.y0 = d.y;
    });
}

// Toggle children on click.
function click(d) {
    if (d.children) {
        d._children = d.children;
        d.children = null;
    } else {
        d.children = d._children;
        d._children = null;
    }
    update(d);
}

function expand(d) {
    var children = (d.children) ? d.children : d._children;
    if (d._children) {
        d.children = d._children;
        d._children = null;
    }
    if (children)
        children.forEach(expand);
}

function collapse(d) {
    if (d.children) {
        d._children = d.children;
        d._children.forEach(collapse);
        d.children = null;
    }
}

function expandAll() {
    expand(root);
    update(root);
}

function collapseAll() {
    root.children.forEach(collapse);
    collapse(root);
    update(root);
}

// ************** functions to save the tree diagram	 *****************

// Set-up the export button
d3.select('#saveButton').on('click', function () {
    var svgString = getSVGString(svg0.node());
    svgString2Image(svgString, 1 * width, 1 * height, 'png', save); // passes Blob and filesize String to the callback
    function save(dataBlob, filesize) {
        saveAs(dataBlob, 'D3 vis exported to PNG.png'); // FileSaver.js function
    }
});


// Below are the functions that handle actual exporting:
// getSVGString ( svgNode ) and svgString2Image( svgString, width, height, format, callback )
function getSVGString(svgNode) {
    svgNode.setAttribute('xlink', 'http://www.w3.org/1999/xlink');
    var cssStyleText = getCSSStyles(svgNode);
    appendCSS(cssStyleText, svgNode);

    var serializer = new XMLSerializer();
    var svgString = serializer.serializeToString(svgNode);
    svgString = svgString.replace(/(\w+)?:?xlink=/g, 'xmlns:xlink='); // Fix root xlink without namespace
    svgString = svgString.replace(/NS\d+:href/g, 'xlink:href'); // Safari NS namespace fix

    return svgString;

    function getCSSStyles(parentElement) {
        var selectorTextArr = [];

        // Add Parent element Id and Classes to the list
        selectorTextArr.push('#' + parentElement.id);
        for (var c = 0; c < parentElement.classList.length; c++)
            if (!contains('.' + parentElement.classList[c], selectorTextArr))
                selectorTextArr.push('.' + parentElement.classList[c]);

        // Add Children element Ids and Classes to the list
        var nodes = parentElement.getElementsByTagName("*");
        for (var i = 0; i < nodes.length; i++) {
            var id = nodes[i].id;
            if (!contains('#' + id, selectorTextArr))
                selectorTextArr.push('#' + id);

            var classes = nodes[i].classList;
            for (var c = 0; c < classes.length; c++)
                if (!contains('.' + classes[c], selectorTextArr))
                    selectorTextArr.push('.' + classes[c]);
        }

        // Extract CSS Rules
        var extractedCSSText = "";
        for (var i = 0; i < document.styleSheets.length; i++) {
            var s = document.styleSheets[i];

            try {
                if (!s.cssRules) continue;
            } catch (e) {
                if (e.name !== 'SecurityError') throw e; // for Firefox
                continue;
            }

            var cssRules = s.cssRules;
            for (var r = 0; r < cssRules.length; r++) {
                if (contains(cssRules[r].selectorText, selectorTextArr))
                    extractedCSSText += cssRules[r].cssText;
            }
        }

        return extractedCSSText;

        function contains(str, arr) {
            return arr.indexOf(str) === -1 ? false : true;
        }

    }

    function appendCSS(cssText, element) {
        var styleElement = document.createElement("style");
        styleElement.setAttribute("type", "text/css");
        styleElement.innerHTML = cssText;
        var refNode = element.hasChildNodes() ? element.children[0] : null;
        element.insertBefore(styleElement, refNode);
    }
}

function svgString2Image(svgString, width, height, format, callback) {
    var format = format ? format : 'png';

    var imgsrc = 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(svgString))); // Convert SVG string to data URL

    var canvas = document.createElement("canvas");
    var context = canvas.getContext("2d");

    canvas.width = width;
    canvas.height = height;

    var image = new Image();
    image.onload = function () {
        context.clearRect(0, 0, width, height);
        context.drawImage(image, 0, 0, width, height);

        canvas.toBlob(function (blob) {
            var filesize = Math.round(blob.length / 1024) + ' KB';
            if (callback) callback(blob, filesize);
        });

    };

    image.src = imgsrc;
}


================================================
FILE: interactiveTreeVisualization/epilepsyClassification2017/treeStyle.css
================================================

.node {
    cursor: pointer;
}

.node circle {
    fill: #fff;
    stroke: steelblue;
    stroke-width: 3px;
}

.node text {
    font: 12px sans-serif;
}

.link {
    fill: none;
    stroke: #ccc;
    stroke-width: 3px;
}

.button {
    background-color: #ccc;
    color: black;
    border: none;
    padding: 15px 32px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition-duration: 0.4s;
    cursor: pointer;
}

.button:hover {
    background-color:steelblue;
}


================================================
FILE: matlabCode/anat/createBIDS_T1w_json_full.m
================================================
% Template Matlab script to create a BIDS compatible file:
%
%  sub-01_ses-01_run-01_acq-FullExample_T1w.json
%
% This example lists only the REQUIRED, RECOMMENDED and OPTIONAL fields.
% When adding additional metadata please use CamelCase

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
run_label = '01';

% The OPTIONAL acq-<label> key/value pair corresponds to a custom label
% the user MAY use to distinguish a different set of parameters used for
% acquiring the same modality.
acq_label = 'FullExample';

name_spec.modality = 'anat';
name_spec.suffix = 'T1w';
name_spec.ext = '.json';

name_spec.entities = struct('ses', ses_label, ...
                            'acq', acq_label, ...
                            'run', run_label, ...
                            'sub', sub_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%%
% Assign the fields in the Matlab structure that can be saved as a json.
% all REQUIRED /RECOMMENDED /OPTIONAL metadata fields for Magnetic Resonance Imaging data

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

%% Scanner Hardware metadata fields
json.Manufacturer = ' ';
json.ManufacturersModelName = ' ';
json.MagneticFieldStrength = ' ';
json.DeviceSerialNumber = ' ';
json.StationName = ' ';
json.SoftwareVersions = ' ';
json.HardcopyDeviceSoftwareVersion = ' ';
l;
json.ReceiveCoilName = ' ';
json.ReceiveCoilActiveElements = ' ';
json.GradientSetType = ' ';
json.MRTransmitCoilSequence = ' ';
json.MatrixCoilMode = ' ';
json.CoilCombinationMethod = ' ';

%% Sequence Specifics metadata fields
json.PulseSequenceType = ' ';
json.ScanningSequence = ' ';
json.SequenceVariant = ' ';
json.ScanOptions = ' ';
json.SequenceName = ' ';
json.PulseSequenceDetails = ' ';
json.NonlinearGradientCorrection = ' ';

%% In-Plane Spatial Encoding metadata fields
json.NumberShots = ' ';
json.ParallelReductionFactorInPlane = ' ';
json.ParallelAcquisitionTechnique = ' ';
json.PartialFourier = ' ';
json.PartialFourierDirection = ' ';
json.WaterFatShift = ' ';
json.EchoTrainLength = ' ';

%% Timing Parameters metadata fields
json.EchoTime = ' ';
json.InversionTime = ' ';
json.SliceEncodingDirection = ' ';
json.DwellTime = ' ';

%% RF & Contrast metadata field
json.FlipAngle = ' ';

%% Slice Acceleration metadata field
json.MultibandAccelerationFactor = ' ';

%% Anatomical landmarks metadata fields
json.AnatomicalLandmarkCoordinates = ' ';

%% Institution information metadata fields
json.InstitutionName = ' ';
json.InstitutionAddress = ' ';
json.InstitutionalDepartmentName = ' ';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/anat/createBIDS_T1w_json_full_schma_based.m
================================================
% Similar to "createBIDS_T1w_json_full.m"
% but relies on the BIDS schema to get a more updated version
% of the list of metadata

% This is work in progress but should become most useful when the BIDS
% shcema is updated to include what are the required fields a given suffix

%%
clear;

this_dir = fileparts(mfilename('fullpath'));

root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
run_label = '01';

% The OPTIONAL acq-<label> key/value pair corresponds to a custom label
% the user MAY use to distinguish a different set of parameters used for
% acquiring the same modality.
acq_label = 'SchemaBased';

name_spec.modality = 'anat';
name_spec.suffix = 'T1w';
name_spec.ext = '.json';

name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'acq', acq_label, ...
                            'run', run_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
anat_json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

% Make sure the directory exists
bids.util.mkdir(fileparts(anat_json_name));

%%
% Assign the fields in the Matlab structure that can be saved as a json.
% all REQUIRED /RECOMMENDED /OPTIONAL metadata fields for Magnetic Resonance Imaging data

fprintf(1, '\n');

anat_json = struct();

schema = bids.Schema;

mri_fields = fieldnames(schema.content.rules.sidecars.mri);

for i = 1:numel(mri_fields)

    this_field = schema.content.rules.sidecars.mri.(mri_fields{i});

    mri_subfields = fieldnames(this_field.fields);

    for j = 1:numel(mri_subfields)

        this_subfield = this_field.fields.(mri_subfields{j});

        if ischar(this_subfield) && strcmp(this_subfield, 'recommended')
            fprintf(1, '%s\n', mri_subfields{j});
            this_field.fields;
            anat_json.(mri_subfields{j}) = ' ';
        end

    end

end

%% Write JSON
% bids.util.jsonencode(anat_json_name, anat_json);

fprintf(1, '\n');


================================================
FILE: matlabCode/anat/createBIDS_T1w_json_short.m
================================================
% Template Matlab script to create a BIDS compatible file:
%
%  sub-01_ses-01_acq-ShortExample_run-01_T1w.json
%
% This example lists only the REQUIRED fields.
% When adding additional metadata please use CamelCase

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));

root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
run_label = '01';

% The OPTIONAL acq-<label> key/value pair corresponds to a custom label
% the user MAY use to distinguish a different set of parameters used for
% acquiring the same modality.
acq_label = 'ShortExample';

name_spec.modality = 'anat';
name_spec.suffix = 'T1w';
name_spec.ext = '.json';

name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'acq', acq_label, ...
                            'run', run_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));

%%
% Assign the fields in the Matlab structure that can be saved as a json.
% all REQUIRED /RECOMMENDED /OPTIONAL metadata fields for Magnetic Resonance Imaging data

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

%% In-Plane Spatial Encoding metadata fields
json.PhaseEncodingDirection = ' ';
json.EffectiveEchoSpacing = ' ';
json.TotalReadoutTime = ' ';

%% Timing Parameters metadata fields
json.EchoTime = ' ';

%% Write JSON
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/eeg-meg/createBIDS_meg_json_full.m
================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create JSON using MATLAB for MEG BIDS:
%
% This template is for MEG data of any kind,
% including but not limited to task-based, resting-state, and noise recordings.
%
% If multiple Tasks were performed within a single Run,
% the task description can be set to "task-multitask".
%
% The _meg.json SHOULD contain details on the Tasks.
%
% Some manufacturers data storage
% conventions use folders which contain data files of various nature:
% for example: CTF's .ds format, or 4D/BTi.
%
% Please refer to Appendix VI for examples from a selection of MEG manufacturers
%
% By @Cofficer, Created 9/03/2018
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'FullExample';
acq_label = 'CTF';
run_label = '1';

% A "proc" (processed) label has been added, especially useful for files coming from Maxfilter
% (for example: sss, tsss, trans, quat, mc, etc.)
proc_label = 'sss';

name_spec.modality = 'meg';
name_spec.suffix = 'meg';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'acq', acq_label, ...
                            'ses', ses_label, ...
                            'task', task_label, ...
                            'run', run_label, ...
                            'proc', proc_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% Assign the fields in the Matlab structure that can be saved as a json.
% The following fields must be defined:

% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab
% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

json.TaskName = task_label;
json.InstitutionName = '';
json.InstitutionAddress = '';
json.Manufacturer = '';
json.ManufacturersModelName = '';
json.SoftwareVersions = '';
json.TaskDescription = '';
json.Instructions = '';
json.CogPOID = 'http://www.cogpo.org/ontologies/CogPOver1.owl#FIXME';
json.DeviceSerialNumber = '';

%%
% The following MEG specific fields must also be defined:
json.SamplingFrequency = '';
json.PowerLineFrequency = '';
json.DewarPosition = '';
json.SoftwareFilters = '';
json.DigitizedLandmarks = '';

json.DigitizedHeadPoints = '';

%%
% The following fields should be present for MEG:
json.MEGChannelCount = [];
json.MEGREFChannelCount = [];
json.EEGChannelCount = [];
json.ECOGChannelCount = [];
json.SEEGChannelCount = [];
json.EOGChannelCount = [];
json.ECGChannelCount = [];
json.EMGChannelCount = [];
json.MiscChannelCount = [];
json.TriggerChannelCount = [];
json.RecordingDuration = [];
json.RecordingType = '';
json.EpochLength = '';
json.ContinuousHeadLocalization = '';
json.HeadCoilFrequency = [];
json.MaxMovement = '';
json.SubjectArtefactDescription = '';
json.AssociatedEmptyRoom = '';

%%
% Specific EEG fields if recorded with MEG
% SHOULD be present:
json.EEGSamplingFrequency = [];
json.EEGPlacementScheme = '';
json.ManufacturersAmplifierModelName = '';
json.EEGReference = '';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/eeg-meg/createBIDS_meg_json_short.m
================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create JSON using MATLAB for MEG BIDS:
%
% This template is for MEG data of any kind, including but not limited to task-based,
% resting-state, and noise recordings.
%
% If multiple Tasks were performed within a single Run,
% the task description can be set to "task-multitask".
%
% The _meg.json SHOULD contain details on the Tasks.
%
% Some manufacturers data storage conventions use folders
% which contain data files of various nature:
% for example: CTF's .ds format, or 4D/BTi.
%
% Please refer to Appendix VI for examples from a selection of MEG manufacturers
%
% By Cofficer, Created 14/03/2018
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'ShortExample';
acq_label = 'CTF';
run_label = '1';

% A "proc" (processed) label has been added, especially useful for files coming from Maxfilter
% (for example: sss, tsss, trans, quat, mc, etc.)
proc_label = 'sss';

name_spec.modality = 'meg';
name_spec.suffix = 'meg';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'acq', acq_label, ...
                            'ses', ses_label, ...
                            'task', task_label, ...
                            'run', run_label, ...
                            'proc', proc_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% Assign the fields in the Matlab structure that can be saved as a json.
% The following fields must be defined:

% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab
% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

%%
json.TaskName = task_label;

%%
json.SamplingFrequency = [];
json.PowerLineFrequency = [];
json.DewarPosition = '';
json.SoftwareFilters = '';
json.DigitizedLandmarks = '';
json.DigitizedHeadPoints = '';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/eeg-meg/rename_brainvision_files.m
================================================
function rename_brainvision_files(varargin)

    % RENAME_BRAINVISION_FILES renames a BrainVision EEG dataset, which consists of a vhdr header
    % file, vmrk marker file and a data file that usually has the extension dat, eeg or seg.
    %
    % Use as
    % rename_brainvision_files(oldname, newname, 'rmf', 'on')
    % where both the old and the new filename should be strings corresponding to the
    % header file, for instance: including the vhdr extension.
    % 'rmf' option indicates to remove old files and can be turned 'on' of 'off' (default)
    %
    % See also http://www.fieldtriptoolbox.org/ and https://sccn.ucsd.edu/wiki/EEGLAB for
    % open source software to process BrainVision EEG data.
    %
    % Robert Oostenveld https://gist.github.com/robertoostenveld/e31637a777c514bf1e86272e1092316e
    % Cyril Pernet - fixed few bugs here and there https://gist.github.com/CPernet/e037df46e064ca83a49fb4c595d4566a

    %% deal with inputs

    rmf = 'off'; % by default do not delete files
    if nargin >= 3
        if strcmpi(varargin{3}, 'rmf')
            if nargin == 3
                disp('no value associated to the remove file option, assuming off');
            else
                rmf = varargin{4};
            end
        else
            error(['unrecognized option argument ''' varargin{3} '''']);
        end
    end

    oldheaderfile = varargin{1};
    newheaderfile = varargin{2};
    clear varargin;

    % determine whether the file extensions should be in lower or upper case
    if ~isempty(regexp(newheaderfile, 'VHDR$', 'once'))
        switchcase = @upper;
    else
        switchcase = @lower;
    end

    % determine the filename without extension
    [~, f, ~] = fileparts(newheaderfile);

    %% do the renaming

    % deal with the header file
    assert(exist(oldheaderfile, 'file') ~= 0, 'the file %s does not exists', oldheaderfile);
    assert(exist(newheaderfile, 'file') == 0, 'the file %s already exists', newheaderfile);
    fid1 = fopen(oldheaderfile, 'r'); % read old
    fid2 = fopen(newheaderfile, 'w'); % write new

    while ~feof(fid1)
        line = fgetl(fid1);
        if ~isempty(regexp(line, '^MarkerFile', 'once'))
            [~, rem] = strtok(line, '=');
            oldmarkerfile = rem(2:end);
            [~, ~, x] = fileparts(oldmarkerfile);
            newmarkerfile = [f switchcase(x)];
            line = sprintf('MarkerFile=%s', newmarkerfile);
        elseif ~isempty(regexp(line, '^DataFile', 'once'))
            [~, rem] = strtok(line, '=');
            olddatafile = rem(2:end);
            [~, ~, x] = fileparts(olddatafile);
            newdatafile = [f switchcase(x)];
            line = sprintf('DataFile=%s', newdatafile);
        end
        fprintf(fid2, '%s\r\n', line);
    end
    fclose(fid1);
    fclose(fid2);

    % deal with the marker file
    if exist(oldmarkerfile, 'file') == 0
        [~, ~, ext] = fileparts(oldmarkerfile);
        [~, ff, ~] = fileparts(oldheaderfile); % re-reading as sometimes weird names comes up
        if exist([ff ext], 'file')
            oldmarkerfile = [ff ext];
        else
            error('the file %s does not exists', oldmarkerfile);
        end
    end
    assert(exist(newmarkerfile, 'file') == 0, 'the file %s already exists', newmarkerfile);
    fid1 = fopen(oldmarkerfile, 'r');
    fid2 = fopen(newmarkerfile, 'w');

    while ~feof(fid1)
        line = fgetl(fid1);
        if ~isempty(regexp(line, '^HeaderFile', 'once'))
            [~, rem] = strtok(line, '=');
            oldheaderfile = rem(2:end);
            [~, ~, x] = fileparts(oldheaderfile);
            newheaderfile = [f switchcase(x)];
            line = sprintf('HeaderFile=%s', newheaderfile);
        elseif ~isempty(regexp(line, '^DataFile', 'once'))
            [~, rem] = strtok(line, '=');
            olddatafile = rem(2:end);
            [~, ~, x] = fileparts(olddatafile);
            newdatafile = [f switchcase(x)];
            line = sprintf('DataFile=%s', newdatafile);
        end
        fprintf(fid2, '%s\r\n', line);
    end
    fclose(fid1);
    fclose(fid2);

    % deal with the data file
    if exist(olddatafile, 'file') == 0
        [~, ~, ext] = fileparts(olddatafile);
        [~, ff, ~] = fileparts(oldheaderfile); % re-reading as sometimes weird names comes up
        if exist([ff ext], 'file')
            olddatafile = [ff ext];
        else
            error('the file %s does not exists', oldmarkerfile);
        end
    end
    assert(exist(newdatafile, 'file') == 0, 'the file %s already exists', newdatafile);
    status = copyfile(olddatafile, newdatafile);
    if ~status
        error('failed to copy data from %s to %s', olddatafile, newdatafile);
    end

    %% delete old files *try* in case of user restriction
    if strcmpi(rmf, 'on')
        try
            delete(oldheaderfile);
        end
        try
            delete(oldmarkerfile);
        end
        try
            delete(olddatafile);
        end
    end


================================================
FILE: matlabCode/fmap/createBIDS_fmap_json.m
================================================
%% Template Matlab script to create an BIDS compatible _fmap.json file
% There are different cases, see BIDS spec 1.0.2 paragraph 8.9
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
%
% DHermes, 2017

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%% Case 1: Phase difference image and at least one magnitude image
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
acq_label = 'Case1';
run_label = '01';

name_spec.modality = 'fmap';
name_spec.suffix = 'phasediff';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'acq', acq_label, ...
                            'run', run_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

json.EchoTime1 = '';
json.EchoTime2 = '';
json.IntendedFor = {'sub-01/ses-01/func/...'
                    'sub-01/ses-01/func/...'};

% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);

%% Case 2: Two phase images and two magnitude images
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
acq_label = 'Case2';
run_label = '01';

name_spec.modality = 'fmap';
name_spec.suffix = 'phase1';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'acq', acq_label, ...
                            'run', run_label);
% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
fmap1_json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

name_spec.suffix = 'phase2';
bids_file = bids.File(name_spec, 'use_schema', true);
fmap2_json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

fmap1_json.EchoTime = '';
fmap1_json.IntendedFor = {'sub-01/ses-01/func/...'
                          'sub-01/ses-01/func/...'};

fmap2_json.EchoTime = '';
fmap2_json.IntendedFor = {'sub-01/ses-01/func/...'
                          'sub-01/ses-01/func/...'};

% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(fmap1_json_name));
bids.util.jsonencode(fmap1_json_name, fmap1_json);
bids.util.jsonencode(fmap2_json_name, fmap2_json);

%% Case 3: A single, real fieldmap image (showing the field inhomogeneity in each voxel)

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
acq_label = 'Case3';
run_label = '01';

name_spec.modality = 'fmap';
name_spec.suffix = 'fieldmap';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'acq', acq_label, ...
                            'run', run_label);
% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

json.Units = '';
json.IntendedFor = {'sub-01/ses-01/func/...'
                    'sub-01/ses-01/func/...'};

% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);

%% Case 4: Multiple phase encoded directions (topup)

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
acq_label = 'Case4';
run_label = '01';

% dir_label value can be set to arbitrary alphanumeric
% label ([a-zA-Z0-9]+ for example "LR" or "AP") that can help users to
% distinguish between different files, but should not be used to infer any
% scanning parameters (such as phase encoding directions) of the corresponding sequence.
dir_label = 'LR';

name_spec.modality = 'fmap';
name_spec.suffix = 'epi';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'acq', acq_label, ...
                            'run', run_label, ...
                            'dir', dir_label);
% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

json.PhaseEncodingDirection = '';
json.TotalReadoutTime = '';
json.IntendedFor = {'sub-01/ses-01/func/...'
                    'sub-01/ses-01/func/...'};

% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/func/createBIDS_bold_json_full.m
================================================
%% Template Matlab script to create an BIDS compatible _bold.json file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
% Use version of DICOM ontology terms whenever possible.
%
% DHermes, 2017

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'FullExample';
run_label = '01';

name_spec.modality = 'func';
name_spec.suffix = 'bold';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'task', task_label, ...
                            'run', run_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

%% Required fields
json.TaskName = 'FullExample';
json.RepetitionTime = [];

%% Required fields if using a fieldmap
json.PhaseEncodingDirection = '';
json.EffectiveEchoSpacing = [];
json.EchoTime = [];

%% Recommended fields:

%% Scanner Hardware metadata fields
json.Manufacturer = '';
json.ManufacturersModelName = '';
json.MagneticFieldStrength = [];
json.DeviceSerialNumber = '';
json.StationName = ' ';
json.SoftwareVersions = ' ';
json.HardcopyDeviceSoftwareVersion = '';
json.ReceiveCoilName = ' ';
json.ReceiveCoilActiveElements = '';
json.GradientSetType = '';
json.MRTransmitCoilSequence = '';
json.MatrixCoilMode = '';
json.CoilCombinationMethod = '';

%% Sequence Specifics metadata fields
json.PulseSequenceType = '';
json.ScanningSequence = '';
json.SequenceVariant = '';
json.ScanOptions = '';
json.SequenceName = '';
json.PulseSequenceDetails = '';
json.NonlinearGradientCorrection = '';

%% In-Plane Spatial Encoding metadata fields
json.NumberShots = [];
json.ParallelReductionFactorInPlane = '';
json.ParallelAcquisitionTechnique = '';
json.PartialFourier = '';
json.PartialFourierDirection = '';
json.WaterFatShift = '';
json.EchoTrainLength = '';

%% Timing Parameters metadata fields
json.InversionTime = [];
json.SliceEncodingDirection = '';
json.DwellTime = [];
json.TotalReadoutTime = [];
json.DelayAfterTrigger = [];
json.NumberOfVolumesDiscardedByScanner = [];
json.NumberOfVolumesDiscardedByUser = [];

%% RF & Contrast metadata field
json.FlipAngle = [];

%% Slice Acceleration metadata field
json.MultibandAccelerationFactor = [];

%% Task metadata field
json.Instructions = '';
json.TaskDescription = '';
json.CogAtlasID = 'https://www.cognitiveatlas.org/FIXME';
json.CogPOID = 'http://www.cogpo.org/ontologies/CogPOver1.owl#FIXME';

%% Institution information metadata fields
json.InstitutionName = '';
json.InstitutionAddress = '';
json.InstitutionalDepartmentName = '';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/func/createBIDS_bold_json_short.m
================================================
%% Template Matlab script to create an BIDS compatible _bold.json file
% This example only lists the required fields.
% When adding additional metadata please use CamelCase
% Use version of DICOM ontology terms whenever possible.
%
% DHermes, 2017

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'ShortExample';
run_label = '01';

name_spec.modality = 'func';
name_spec.suffix = 'bold';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'task', task_label, ...
                            'run', run_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

%% Required fields
json.TaskName = 'ShortExample';
json.RepetitionTime = [];
json.SliceTiming = [];

%% Required fields if using a fieldmap
json.PhaseEncodingDirection = '';
json.EffectiveEchoSpacing = [];
json.EchoTime = [];

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/general/README.md
================================================
# Code to generate "modality agnostic" BIDS files

## bids_spreadsheet2participants

This function requires Matlab 2018a or above to run.

Run the following in Matlab:

```matlab
cd matlabCode/general
input_file = fullfile(pwd, 'input', 'input_to_create_participants_file.xlsx')
files_out = bids_spreadsheet2participants(input_file, 'ignore', 'comment')
```


================================================
FILE: matlabCode/general/bids_spreadsheet2participants.m
================================================
function files_out = bids_spreadsheet2participants(varargin)
    %
    % routine to takes an spreadsheet file (for example: excel) as input and export as participants.tsv
    % and participants.json
    %
    % FORMAT files_out = bids_spreadsheet2participants(file_in,'ignore','field1','field2',...)
    %
    % INPUTS if empty user is prompted:
    %
    %   - 'file_in' is the excel file, with at least the 3 BIDS mandatory fields in the 1st sheet:
    %       - participant_id,
    %       - age,
    %       - gender
    %
    %     A second sheet can be used to specify variables for the json file column format:
    %       - variable name (same as sheet 1),
    %       - description,
    %       - values (optional)
    %
    %   - 'ignore' is the key to ignore specific fields (columns) in the excel file
    %     for example: 'ignore', 'variableX', 'variableY'
    %
    %   - 'export_dir' is the directory to save output files
    %
    % OUTPUT:
    %
    %   - 'files_out' is a cell array with:
    %       - files_out{1} the full name of the particpiants.tsv
    %       - files_out{2} the full name of the particpiants.json
    %
    % EXAMPLE:
    %
    %   files_out = bids_spreadsheet2participants('D:\icpsr_subset.xlsx','ignore','EEGtesttime')
    %
    % the spreadsheet must have:
    %   worksheet 1 with data, each column has a variable name and values
    %       -- note missing values MUST be n/a or nill
    %   worksheet 2 is optional with columns variables, Description, Levels, Units to describe worksheet 1
    %   variables similar to
    % https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#participants-file
    %       -- note the order of 'Levels' names should match the order of apparition in the data
    %          to have an exact match
    %
    % Requires matlab 2018a or above
    %
    % Cyril Pernet - March 2021
    % ---------------------------------

    if verLessThan('matlab', '9.4')
        error('This function requires matlab 2018a or above.');
    end

    files_out = cell(2, 1);
    % check library
    if ~exist('jsonwrite.m', 'file')
        if exist(fullfile(fileparts(which('bids_spreadsheet2participants.m')), 'JSONio'), 'dir')
            addpath(fullfile(fileparts(which('bids_spreadsheet2participants.m')), 'JSONio'));
        else
            error(['JSONio library needed, available with EEGLAB bids-matlab-tools or', ...
                   'at https://github.com/gllmflndn/JSONio']);
        end
    end

    %% deal with input file
    if nargin == 0
        [filename, pathname] = uigetfile({'*.xlsx;*.ods;*.xls'}, 'Pick an spreadsheet file');
        if isequal(filename, 0) || isequal(pathname, 0)
            disp('Selection cancelled');
            return
        else
            filein = fullfile(pathname, filename);
            disp(['file selected: ', filein]);
        end
    else
        filein = varargin{1};
        if ~exist(filein, 'file')
            error('%s not found', filein);
        end
    end

    % detect what's inside the selected file
    sheet1_opts = detectImportOptions(filein, 'Sheet', 1);
    try
        sheet2_opts = detectImportOptions(filein, 'PreserveVariableNames', true, 'Sheet', 2);
    catch one_sheet
        fprintf('import only variables: %s\n', one_sheet.message);
        sheet2_opts = [];
    end

    %% quickly check other arguments are valid
    if nargin > 1
        if ~any(contains(varargin, {'ignore', 'export'}, 'IgnoreCase', true))
            error('key input arguments in are missing ''ignore'' and/or ''export_dir''');
        else
            if any(contains(varargin, 'export', 'IgnoreCase', true))
                export_dir = varargin{find(contains(varargin, 'export', 'IgnoreCase', true)) + 1};
            end

            if any(contains(varargin, 'ignore', 'IgnoreCase', true))
                if any(contains(varargin, 'export', 'IgnoreCase', true))
                    if find(contains(varargin, 'ignore', 'IgnoreCase', true)) < ...
                      find(contains(varargin, 'export', 'IgnoreCase', true))
                        ignore_var = find(contains(varargin, 'ignore', 'IgnoreCase', true)) + ...
                          1:find(contains(varargin, 'export', 'IgnoreCase', true)) - 1;
                    else
                        ignore_var = find(contains(varargin, 'ignore', 'IgnoreCase', true)) + 1:nargin;
                    end
                else
                    ignore_var = find(contains(varargin, 'ignore', 'IgnoreCase', true)) + 1:nargin;
                end
            end
        end
    end

    %% create particpiants.tsv
    Data = readtable(filein, sheet1_opts);

    % 1st check mandatory/recommended fields are presents
    participant_idvar = any(strcmpi(Data.Properties.VariableNames, 'participant_id'));
    idvar = any(strcmpi(Data.Properties.VariableNames, 'id'));
    if idvar == 0 && participant_idvar == 0
        error('no participant ID variable detected, invalid file');
    elseif idvar == 1 && participant_idvar == 0
        disp('ID variable detected, the BIDS value exported will be participant_id ');
        Data.Properties.VariableNames(strcmpi(Data.Properties.VariableNames, 'id')) = {'participant_id'};
    end

    if length(unique(Data.participant_id)) ~= length(Data.participant_id)
        [~, idx] = unique(Data.participant_id);
        non_unique = setdiff(1:length(Data.participant_id), idx);
        non_unique = cell2mat(Data.participant_id(non_unique));
        for id = 1:size(non_unique, 1)
            warning('some IDs are duplicate: %s', non_unique(id, :));
        end
        error('non unique IDS are not permitted');
    end

    if any(strcmp(Data.Properties.VariableNames, 'Sex'))
        Data.Properties.VariableNames(strcmpi(Data.Properties.VariableNames, 'Sex')) = {'sex'};
    end
    sexvar = any(strcmpi(Data.Properties.VariableNames, 'sex'));
    gendervar = any(strcmpi(Data.Properties.VariableNames, 'gender'));
    if gendervar == 1 && sexvar == 0
        disp('gender variable detected - the recommended optional field is ''sex'' but ok using gender');
    end

    if any(strcmp(Data.Properties.VariableNames, 'Age'))
        Data.Properties.VariableNames(strcmpi(Data.Properties.VariableNames, 'Age')) = {'age'};
    end
    if ~any(strcmpi(Data.Properties.VariableNames, 'age'))
        disp('age variable is missing - this is only an optional field still exporting');
    else
        if ~isnumeric(Data.age)
            for v = 1:length(Data.age)
                Data.age{v} = str2double(Data.age{v});
            end
            Data.age = cell2mat(Data.age); % ensure age treated as number
        end
    end

    % 2nd check if any of those variable should be removed - and feedback if
    % some input variable names were not found
    if nargin > 1
        if any(contains(varargin, 'ignore', 'IgnoreCase', true))
            for var = ignore_var
                if any(contains(Data.Properties.VariableNames, varargin{var}, 'IgnoreCase', true))
                    Data = removevars(Data, varargin{var});
                else
                    fprintf('''%s'' input variable to ignore not recognized - skipping it\n', varargin{var});
                end
            end
        else
            warning('ignore argument not recognized - skipping any options');
        end
    end

    % last check variable values (also useful for metadata)
    if any(~contains(Data.participant_id, 'sub-'))
        disp('participant_id should include ''sub-'', adding it to current IDs');
        for sub = 1:length(Data.participant_id)
            if ~contains(Data.participant_id{sub}, 'sub-')
                Data.participant_id{sub} = ['sub-' Data.participant_id{sub}];
            end
        end
    end

    value_types = varfun(@class, Data, 'OutputFormat', 'cell');
    for v = length(value_types):-1:1
        values{v} = unique(Data.(Data.Properties.VariableNames{v}));
    end

    export_data = convert_NAN_to_na(Data);

    if ~exist('export_dir', 'var')
        export_dir = uigetdir(fileparts(filein), 'Select directory to save exported files');
        if export_dir == 0
            export_dir = fileparts(filein);
        end
    end
    try
        writetable(export_data, [export_dir filesep 'participants.tsv'], 'FileType', 'text', 'Delimiter', '\t');
        files_out{1} = fullfile(export_dir, 'participants.tsv');
        fprintf('participants.tsv file saved in %s\n', export_dir);
        clear export_data;
    catch tsv_error
        files_out{2} = 'particpants.tsv file not created';
        error('participants.tsv not saved %s\n', tsv_error.mewsage);
    end

    %% create participants.json
    if ~isempty(sheet2_opts)
        GivenMetaData = readtable(filein, sheet2_opts);

        if any(contains(GivenMetaData.Properties.VariableNames, 'Variable'))
            GivenMetaData.Properties.VariableNames(strcmpi(GivenMetaData.Properties.VariableNames, 'Variable')) = ...
              {'variables'};
        elseif any(contains(GivenMetaData.Properties.VariableNames, 'variable'))
            GivenMetaData.Properties.VariableNames(strcmpi(GivenMetaData.Properties.VariableNames, 'variable')) = ...
              {'variables'};
        end

        if ~any(strcmpi('variables', GivenMetaData.Properties.VariableNames))
            warning('metadata sheet provided but ''variables name'' not found - using worksheet 1');
        else
            % given variables present check description
            if ~any(contains(GivenMetaData.Properties.VariableNames, 'description', 'IgnoreCase', true))
                warning('metadata sheet provided but ''description of variables'' not found - using worksheet 1');
            else
                matched_var = cellfun(@(x) find(strcmpi(x, Data.Properties.VariableNames)), GivenMetaData.variables, ...
                                      'UniformOutput', false);
                matched_var(cellfun(@(x) isempty(x), matched_var')) = {0}; % mark empty as 0
                try
                    matched_var = cell2mat(matched_var); % works if unique, ie one value per cell
                    if any(contains(GivenMetaData.Properties.VariableNames, 'description'))
                        GivenMetaData.Properties.VariableNames(strcmpi(GivenMetaData.Properties.VariableNames, ...
                                                                       'description')) = ...
                          {'Description'};
                    end
                catch matched_var_err
                    warning(['variable names between worksheets likely not unique,', ...
                             ' skipping provided metadata \n%s\n'], ...
                            matched_var_err.message); %#ok<MEXCEP>
                end
            end

            % given variables present check levels
            if ~any(contains(GivenMetaData.Properties.VariableNames, 'level', 'IgnoreCase', true))
                warning('metadata sheet provided but ''levels'' not found - using worksheet 1');
            else
                if any(contains(GivenMetaData.Properties.VariableNames, 'level'))
                    GivenMetaData.Properties.VariableNames(strcmpi(GivenMetaData.Properties.VariableNames, ...
                                                                   'level')) = ...
                      {'Levels'};
                elseif any(contains(GivenMetaData.Properties.VariableNames, 'levels'))
                    GivenMetaData.Properties.VariableNames(strcmpi(GivenMetaData.Properties.VariableNames, ...
                                                                   'levels')) = ...
                      {'Levels'};
                end
            end

            % given variables present check unit
            if ~any(contains(GivenMetaData.Properties.VariableNames, 'unit', 'IgnoreCase', true))
                warning('metadata sheet provided but ''Units'' of variables not found');
            else
                if any(contains(GivenMetaData.Properties.VariableNames, 'unit'))
                    GivenMetaData.Properties.VariableNames(strcmpi(GivenMetaData.Properties.VariableNames, ...
                                                                   'unit')) = ...
                      {'Units'};
                elseif any(contains(GivenMetaData.Properties.VariableNames, 'units'))
                    GivenMetaData.Properties.VariableNames(strcmpi(GivenMetaData.Properties.VariableNames, ...
                                                                   'units')) = ...
                      {'Units'};
                end
            end
        end
    else
        matched_var = zeros(length(Data.Properties.VariableNames), 1);
    end

    % prepare json variables from worksheet 1
    % 'values' are the unique values read on the data
    % 'value_types' gives an indication if we want to use Level or Unit
    % we can complement with GivenMetaData.Description, GivenMetaData.Levels and GivenMetaData.Units
    % using 'matched_var' for instance: variables names match between worksheet

    json = struct;
    for var = 1:length(Data.Properties.VariableNames)
        if ~strcmpi(Data.Properties.VariableNames{var}, 'participant_id')
            % add description
            if ismember(var, matched_var)
                if any(contains(GivenMetaData.Properties.VariableNames, 'Description'))
                    if ~isempty(GivenMetaData.Description{matched_var == var})
                        json.(Data.Properties.VariableNames{var}).Description = ...
                          GivenMetaData.Description{matched_var == var};
                    else
                        json.(Data.Properties.VariableNames{var}).Description = [];
                    end
                end
            else
                json.(Data.Properties.VariableNames{var}).Description = [];
            end

            % add Levels and Units
            if strcmpi(value_types{var}, 'cell') % likely Levels
                if ismember(var, matched_var) && any(contains(GivenMetaData.Properties.VariableNames, 'Levels'))
                    if ~isempty(GivenMetaData.Levels{matched_var == var})
                        tmp = lower(GivenMetaData.Levels{matched_var == var});
                        tmp = regexprep(tmp, '\t', ';'); % in case tab is used
                        tmp(isspace(tmp)) = []; % deblank as well
                        separators = sort([strfind(tmp, ';') strfind(tmp, ',') length(tmp)]);
                        index1 = 1;
                        index2 = separators(1) - 1;
                        for l = 1:length(separators)
                            Levels{l} = tmp(index1:index2);
                            if l < length(separators)
                                index1 = separators(l) + 1;
                                index2 = separators(l + 1);
                            end
                        end

                        tmp = values{var};
                        tmp(strcmpi(tmp, 'n/a')) = [];
                        tmp(strcmpi(tmp, 'nill')) = [];
                        if length(tmp) ~= length(Levels)
                            warning('Levels of ''%s'' between data and metadata don''t match', ...
                                    Data.Properties.VariableNames{var});
                            % only write fields
                            for v = 1:length(tmp)
                                json.(Data.Properties.VariableNames{var}).Levels.(tmp{v}) = [];
                            end
                        else
                            % store levels
                            for v = 1:length(tmp)
                                json.(Data.Properties.VariableNames{var}).Levels.(tmp{v}) = Levels{v};
                            end
                        end
                    else
                        json.(Data.Properties.VariableNames{var}).Levels = [];
                    end
                else % no metadata
                    json.(Data.Properties.VariableNames{var}).Levels = values{var};
                end
            else % likely units
                if ismember(var, matched_var) && any(contains(GivenMetaData.Properties.VariableNames, 'Units'))
                    if ~isempty(GivenMetaData.Levels{var})
                        json.(Data.Properties.VariableNames{var}).Units = ...
                          lower(GivenMetaData.Units{matched_var == var});
                    else
                        json.(Data.Properties.VariableNames{var}).Units = [];
                    end
                else % no metadata
                    json.(Data.Properties.VariableNames{var}).Units = [];
                end
            end
        end
    end

    try
        jsonwrite([export_dir filesep 'participants.json'], json, struct('indent', ' '));
        files_out{2} = fullfile(export_dir, 'participants.json');
        fprintf('participants.json file saved in %s\n', export_dir);
        warndlg(sprintf('json file created, do check it ! \n it is almost certain it needs editing'), ...
                'BIDS spec', 'modal');
    catch json_err
        files_out{2} = 'particpants.json file not created';
        error('participants.json not saved %s\n', json_err.mewsage);
    end

end

function export_data = convert_NAN_to_na(data)

    % make sure to export NaN as n/a
    export_data = data;

    for v = 1:length(export_data.Properties.VariableNames)

        if strcmp(class(export_data.(cell2mat(export_data.Properties.VariableNames(v)))), 'double')

            export_data.(cell2mat(export_data.Properties.VariableNames(v))) = ...
              num2cell(export_data.(cell2mat(export_data.Properties.VariableNames(v))));

            for n = 1:size(export_data.(cell2mat(export_data.Properties.VariableNames(v))), 1)
                if isnan(export_data.(cell2mat(export_data.Properties.VariableNames(v))){n})
                    export_data.(cell2mat(export_data.Properties.VariableNames(v))){n} = 'n/a';
                end
            end

        end

    end

end


================================================
FILE: matlabCode/general/createBIDS_dataset_description_json.m
================================================
%% Template Matlab script to create an BIDS compatible dataset_description.json file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
%
% DHermes, 2017

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project_label = 'templates';

json_label = 'dataset_description';

json_name = fullfile(root_dir, project_label, 'dataset_description.json');

%% General fields, shared with MRI BIDS and MEG BIDS:

%% Required fields:

% name of the dataset
json.Name = '';

% The version of the BIDS standard that was used
json.BIDSVersion = '1.7.0';

% The interpretation of the dataset. MUST be one of "raw" or "derivative".
% For backwards compatibility, the default value is "raw".
json.DatasetType = 'raw';

%% Recommended fields:

% what license is this dataset distributed under? The
% use of license name abbreviations is suggested for specifying a license.
% A list of common licenses with suggested abbreviations can be found in appendix III.
json.License = '';

% List of individuals who contributed to the
% creation/curation of the dataset
json.Authors = {'', '', ''};

json.Acknowledgements = ''; % who should be acknowledge in helping to collect the data

% Instructions how researchers using this
% dataset should acknowledge the original authors. This field can also be used
% to define a publication that should be cited in publications that use the
% dataset.
json.HowToAcknowledge = '';

% sources of funding (grant numbers)
json.Funding = {'', '', ''};

% List of ethics committee approvals of the research protocols and/or protocol identifiers.
json.EthicsApprovals = {''};

% a list of references to
% publication that contain information on the dataset, or links.
json.ReferencesAndLinks = {'', '', ''};

% the Document Object Identifier of the dataset
% (not the corresponding paper).
json.DatasetDOI = 'doi:';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/general/createBIDS_events_tsv_json_full.m
================================================
%% Template Matlab script to create an BIDS compatible sub-01_ses-01_task-FullExample-01_events.tsv file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
%
% anushkab, 2018

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'FullExample';
run_label = '01';

name_spec.modality = 'func';
name_spec.suffix = 'events';
name_spec.ext = '.tsv';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'task', task_label, ...
                            'run', run_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
events_tsv_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);
events_json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.json_filename);

%% make an event table and save

%% CONTAINS a set of REQUIRED and OPTIONAL columns
% REQUIRED Onset (in seconds) of the event measured from the beginning of
% the acquisition of the first volume in the corresponding task imaging data file.
% If any acquired scans have been discarded before forming the imaging data file,
% ensure that a time of 0 corresponds to the first image stored. In other words
% negative numbers in onset are allowed.
tsv.onset = 0;

% REQUIRED. Duration of the event (measured from onset) in seconds.
% Must always be either zero or positive. A "duration" value of zero implies
% that the delta function or event is so short as to be effectively modeled as an impulse.
tsv.duration = 0;

% OPTIONAL Primary categorisation of each trial to identify them as instances
% of the experimental conditions
tsv.trial_type = {'afraid'};

% OPTIONAL. Response time measured in seconds. A negative response time can be
% used to represent preemptive responses and n/a denotes a missed response.
tsv.response_time = 0;

% OPTIONAL Represents the location of the stimulus file (image, video, sound etc.)
% presented at the given onset time
tsv.stim_file = {' '};

% OPTIONAL Hierarchical Event Descriptor (HED) Tag.
tsv.HED = {' '};

%% Save table
bids.util.tsvwrite(events_tsv_name, tsv);

%% associated data dictionary

template = struct('LongName', '', ...
                  'Description', '', ...
                  'Levels', [], ...
                  'Units', '', ...
                  'TermURL', '');

json.trial_type = template;
json.trial_type.Description = 'Emotion image type';
json.trial_type.Levels = struct('afraid', 'A face showing fear is displayed', ...
                                'angry', 'A face showing anger is displayed');

json.identifier.LongName = 'Unique identifier from Karolinska (KDEF) database';
json.identifier.Description = 'ID from KDEF database used to identify the displayed image';

json.StimulusPresentation.OperatingSystem = 'Linux Ubuntu 18.04.5';
json.StimulusPresentation.SoftwareName = 'Psychtoolbox';
json.StimulusPresentation.SoftwareRRID = 'SCR_002881';
json.StimulusPresentation.SoftwareVersion = '3.0.14';
json.StimulusPresentation.Code = 'doi:10.5281/zenodo.3361717';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(events_json_name));
bids.util.jsonencode(events_json_name, json);


================================================
FILE: matlabCode/general/createBIDS_participants_tsv.m
================================================
%% Template Matlab script to create an BIDS compatible participants.tsv file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
%
% DHermes, 2017

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project_label = 'templates';

participants_tsv_name = fullfile(root_dir, project_label, 'participants.tsv');

%% make a participants table and save

tsv.participant_id = {'sub-01'; 'sub-epilepsy01'};
tsv.age = [0; 10];
tsv.sex = {'m'; 'f'};
tsv.handedness = {'l'; 'r'};

bids.util.tsvwrite(participants_tsv_name, tsv);

%% associated data dictionary

template = struct( ...
                  'LongName', '', ...
                  'Description', '', ...
                  'Levels', struct(), ...
                  'Units', '', ...
                  'TermURL', 'http://www.todo.com/fixme');

json.age = template;
json.age.Description = 'age of the participant';
json.age.Units = 'years';

json.sex = template;
json.sex.Description = 'sex of the participant as reported by the participant';
json.sex.Levels = struct( ...
                         'm', 'male', ...
                         'f', 'female');

json.handedness = template;
json.handedness.Description = 'handedness of the participant as reported by the participant';
json.handedness.Levels = struct( ...
                                'l', 'left', ...
                                'r', 'right');

json_name = fullfile(root_dir, project_label, 'participants.json');

% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/general/createBIDS_samples_tsv.m
================================================
%% Template Matlab script to create an BIDS compatible samples.tsv file

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project_label = 'templates';

samples_tsv_name = fullfile(root_dir, project_label, 'samples.tsv');

%% make a participants table and save

tsv.sample_id = {'sample-01'; 'sample-02'};
tsv.participant_id = {'sub-01'; 'sub-epilepsy01'};
tsv.sample_type = {'tissue'; 'tissue'};

bids.util.tsvwrite(samples_tsv_name, tsv);

%% associated data dictionary

% use the BIDS schema to get the official definitions
schema = bids.Schema;

columns = fieldnames(tsv);

for i = 1:numel(columns)
    def = schema.get_definition(columns{i});
    json.(columns{i}).LongName = def.display_name;
    json.(columns{i}).Description = def.description;
end

json_name = fullfile(root_dir, project_label, 'samples.json');

% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/general/tests/data/participants.json
================================================
{
 "collectionIssues": {
  "Description": [],
  "Levels": [
   "broken trigger cable, no EEG codes",
   "nill",
   "no EEG",
   "no MRI",
   "none"
  ]
 },
 "CognitiveTest1": {
  "Description": [],
  "Units": []
 },
 "CognitiveTest2": {
  "Description": [],
  "Units": []
 },
 "testdate": {
  "Description": "data collection start time",
  "Units": []
 },
 "age": {
  "Description": "Age in years",
  "Units": []
 },
 "sex": {
  "Description": "Sex",
  "Levels": {
   "Female": "male",
   "Male": "female"
  }
 }
}


================================================
FILE: matlabCode/general/tests/data/participants.tsv
================================================
participant_id	collectionIssues	CognitiveTest1	CognitiveTest2	testdate	age	sex
sub-control1	none	8	1	01-Nov-2019	n/a	nill
sub-control2	none	11	2	01-Nov-2019	n/a	nill
sub-control3	no MRI	n/a	1	NaT	n/a	Male
sub-control4	none	8	1	07-Nov-2019	5.52328767123288	Female
sub-control5	none	8	2	07-Nov-2019	5.06575342465753	Female
sub-control6	none	11	1	04-Feb-2020	5.4986301369863	Male
sub-patient1	nill	n/a	5	NaT	n/a	Female
sub-patient2	no EEG	7	4	NaT	n/a	nill
sub-patient3	none	11	3	12-Dec-2019	5.68219178082192	Male
sub-patient4	none	8	1	20-Feb-2020	n/a	nill
sub-patient5	none	11	4	05-Dec-2019	5.12054794520548	Female
sub-control7	none	9	1	12-Dec-2019	5.35342465753425	Male
sub-control8	none	9	2	05-Dec-2019	5.71506849315069	Female
sub-control9	none	9	1	04-Feb-2020	5.2	Female
sub-control10	broken trigger cable, no EEG codes	9	2	NaT	n/a	Female
sub-patient6	none	11	5	11-Feb-2020	5.63013698630137	Female


================================================
FILE: matlabCode/general/tests/test_bids_spreadsheet2participants.m
================================================
% requires:
% - moxunit: https://github.com/MOxUnit/MOxUnit
% - bids-matlab

addpath(fullfile(pwd, '..'));

input_file = fullfile(pwd, '..', 'input', 'spreadsheet_to_convert.xlsx');
files_out = bids_spreadsheet2participants(input_file, 'ignore', 'comment', 'export', pwd);

json_expected = jsonread(fullfile(pwd, 'data', 'participants.json'));
json_actual = jsonread(fullfile(pwd, 'participants.json'));
% uses moxunit assertEqual
assertEqual(json_actual, json_expected);

tsv_expected  = bids.util.tsvread(fullfile(pwd, 'data', 'participants.tsv'));
tsv_actual  = bids.util.tsvread(fullfile(pwd, 'participants.tsv'));
assertEqual(tsv_actual, tsv_expected);


================================================
FILE: matlabCode/ieeg/createBIDS_channels_tsv.m
================================================
%% Template Matlab script to create an BIDS compatible electrodes.tsv file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
%
% DHermes, 2017
% modified Jaap van der Aar 30.11.18

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'LongExample';
run_label = '01';

name_spec.modality = 'ieeg';
name_spec.suffix = 'channels';
name_spec.ext = '.tsv';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'task', task_label, ...
                            'run', run_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
channels_tsv_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% make a participants table and save

%% required columns
name = {'n/a'}; % Label of the channel, only contains letters and numbers. The label must
% correspond to _electrodes.tsv name and all ieeg type channels are required to have \
% a position. The reference channel name MUST be provided in the reference column

type = {'n/a'}; % Type of channel, see below for adequate keywords in this field

units = {'n/a'}; % Physical unit of the value represented in this channel, for example: V for Volt,
% specified according to the SI unit symbol and possibly prefix symbol (for example: mV, ?V),
% see the BIDS spec (section 15 Appendix V: Units) for guidelines for Units and Prefixes.

low_cutoff = [0]; % Frequencies used for the low pass filter applied to the
% channel in Hz. If no low pass filter was applied, use n/a. Note that
% anti-alias is a low pass filter, specify its frequencies here if applicable.

high_cutoff = [0]; % Frequencies used for the high pass filter applied to
% the channel in Hz. If no high pass filter applied, use n/a.

%% recommended columns:

reference = {'n/a'}; % Specification of the reference (for example: "mastoid", "ElectrodeName01",
% "intracranial", "CAR", "other", "n/a"). If the channel is not an electrode channel
% (for example: a microphone channel) use `n/a`.

group = {'n/a'}; % Which group of channels (grid/strip/probe) this channel belongs to.
% One group has one wire and noise can be shared. This can be a name or number.
% Note that any groups specified in `_electrodes.tsv` must match those present here.

%% optional columns

sampling_frequency = [0]; % Sampling rate of the channel in Hz.

description = {'n/a'}; % Brief free-text description of the channel, or other information of
% interest (for example: position (for example: 'left lateral temporal surface', 'unipolar/bipolar', etc.)).

notch = [0]; % Frequencies used for the notch filter applied to the channel,
% in Hz. If no notch filter applied, use n/a.

status = {'bad'}; % Data quality observed on the channel (good/bad). A channel is considered bad
% if its data quality is compromised by excessive noise. Description of noise type SHOULD be
% provided in [status_description].

status_description = {'n/a'}; % Freeform text description of noise or artifact affecting data
% quality on the channel. It is meant to explain why the channel was declared bad in [status].

%% write
t = table(name, type, units, low_cutoff, high_cutoff, reference, ...
          group, sampling_frequency, description, notch, status, status_description);

writetable(t, channels_tsv_name, 'FileType', 'text', 'Delimiter', '\t');


================================================
FILE: matlabCode/ieeg/createBIDS_coordsystem_json.m
================================================
%% Template Matlab script to create an BIDS compatible _electrodes.json file
% For BIDS-iEEG
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
%
% DHermes, 2017
% modified Jaap van der Aar 30.11.18

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';

name_spec.modality = 'ieeg';
name_spec.suffix = 'coordsystem';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% Assign the fields in the Matlab structure that can be saved as a json.
% The following fields must be defined:

% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab
% For example
schema = bids.Schema;
def = schema.get_definition('iEEGCoordinateSystem');
fprintf(def.description);

%% Required fields
json.iEEGCoordinateSystem = '';
json.iEEGCoordinateUnits = '';

%% Recommended fields
json.iEEGCoordinateProcessingDescripton = '';
json.IndendedFor = '';
json.iEEGCoordinateProcessingDescription = '';
json.iEEGCoordinateProcessingReference = '';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/ieeg/createBIDS_data_WriteBrainVisionWithFieldtrip.m
================================================
% %%%%% save data as BrainVision BIDS %%%%%
%
% Sample script that calls Fieldtrip functions to write a Brainvision dataset
% Added fields are examples, read these from the raw data
%
% Fieldtrip has to be in the path!
%
% D. Hermes 2018

% provide necessary labels and path to save the data:
dataRootPath = '';
sub_label = '01';
ses_label = '01';
task_label = 'visual';
run_label = '01';

% name to save data:
ieeg_name_save = fullfile(dataRootPath, ['sub-' sub_label], ['ses-' ses_label], 'ieeg', ...
                          ['sub-' sub_label...
                           '_ses-' ses_label...
                           '_task-' task_label...
                           '_run-' run_label ...
                           '_ieeg']);

%%%% assign header fields:

% sampling frequency
dataStruct.hdr.Fs = 1000;
dataStruct.hdr.nChans = 128;

% number of channels
dataStruct.hdr.label = cell(dataStruct.hdr.nChans, 1);
for kk = 1:dataStruct.hdr.nChans
    dataStruct.hdr.label{kk} = ['iEEG' int2str(kk)];
end

% number of samples
dataStruct.hdr.nSamples = 10000;

% ?
dataStruct.hdr.nSamplesPre = 0;

% 1 trial for continuous data
dataStruct.hdr.nTrials = 1;

% channels type, see BIDS list of types
dataStruct.hdr.chantype = cell(dataStruct.hdr.nChans, 1);
for kk = 1:dataStruct.hdr.nChans
    dataStruct.hdr.chantype{kk} = ['ECOG'];
end

% I still don't how to indicate the mu in BIDS, now using letter u
dataStruct.hdr.chanunit = repmat({'uV'}, size(d.data, 2), 1);

% labels again, same as before
dataStruct.label = dataStruct.hdr.label;

% time vector
dataStruct.time{1} = [1:dataStruct.hdr.nSamples] / dataStruct.hdr.Fs;

% put the data matrix here: electrodes x samples
dataStruct.trial{1} = data;

% sampling freq again, same as before
dataStruct.fsample = dataStruct.hdr.Fs;

% ?
dataStruct.sampleinfo = [1 dataStruct.hdr.nSamples];

% now fetch a header
hdr_data = ft_fetch_header(dataStruct);

% save the data
ft_write_data(ieeg_name_save, dataStruct.trial{1}, 'header', hdr_data, 'dataformat', 'brainvision_eeg');


================================================
FILE: matlabCode/ieeg/createBIDS_electrodes_tsv.m
================================================
%% Template Matlab script to create an BIDS compatible electrodes.tsv file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
%
% DHermes, 2017
% modified Giulio Castegnaro 201811

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%
clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';

name_spec.modality = 'ieeg';
name_spec.suffix = 'electrodes';
name_spec.ext = '.tsv';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
electrodes_tsv_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% make a participants table and save

% to get the definition of each column,
% you can use the bids.Schema class from bids matlab
% For example
schema = bids.Schema;
def = schema.get_definition('size');
fprintf(def.description);

%% required columns
tsv.name = {'n/a'};
tsv.x = 0;
tsv.y = 0;
tsv.z = 0;
tsv.size = 0;

%% recommended columns
tsv.material = {'n/a'};
tsv.manufacturer = {'n/a'};
tsv.group = {'n/a'};
tsv.hemisphere = {'n/a'};

%% optional columns
tsv.type = {'n/a'};
tsv.impedance = nan;

%% write
bids.util.tsvwrite(electrodes_tsv_name, tsv);


================================================
FILE: matlabCode/ieeg/createBIDS_ieeg_json.m
================================================
%% Template Matlab script to create an BIDS compatible _ieeg.json file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
%
% DHermes, 2017
% modified Jaap van der Aar & Giulio Castegnaro 30.11.18

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'LongExample';
run_label = '01';

name_spec.modality = 'ieeg';
name_spec.suffix = 'ieeg';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'task', task_label, ...
                            'run', run_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% General fields, shared with MRI BIDS and MEG BIDS

% to get the definition of each column,
% you can use the bids.Schema class from bids matlab
% For example
schema = bids.Schema;
def = schema.get_definition('TaskName');
fprintf(def.description);

%% Required fields:
json.TaskName = task_label;
json.SamplingFrequency = [];
json.PowerLineFrequency = [];
json.SoftwareFilters = '';

%% Recommended fields:
HardwareFilters.HighpassFilter.CutoffFrequency = [];
HardwareFilters.LowpassFilter.CutoffFrequency = [];
json.HardwareFilters = HardwareFilters; %

json.Manufacturer = '';
json.ManufacturersModelName = '';
json.TaskDescription = '';
json.Instructions = '';
json.CogAtlasID = 'https://www.cognitiveatlas.org/FIXME';
json.CogPOID = 'http://www.cogpo.org/ontologies/CogPOver1.owl#FIXME';
json.InstitutionName = '';
json.InstitutionAddress = '';
json.DeviceSerialNumber = '';
json.ECOGChannelCount = [];
json.SEEGChannelCount = [];
json.EEGChannelCount = [];
json.EOGChannelCount = [];
json.ECGChannelCount = [];
json.EMGChannelCount = [];
json.MiscChannelCount = [];
json.TriggerChannelCount = [];
json.RecordingDuration = [];
json.RecordingType = '';
json.EpochLength = [];
json.SubjectArtefactDescription = '';
json.SoftwareVersions = '';

%% Specific iEEG fields:

% If mixed types of references, manufacturers or electrodes are used, please
% specify in the corresponding table in the _electrodes.tsv file

%% Required fields:
json.iEEGReference = '';

%% Recommended fields:
json.ElectrodeManufacturer = '';
json.ElectrodeManufacturersModelName = '';
json.iEEGGround = '';
json.iEEGPlacementScheme = '';
json.iEEGElectrodeGroups = '';

%% Optional fields:
json.ElectricalStimulation = '';
json.ElectricalStimulationParameters = '';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/micr/createBIDS_micr_json_full.m
================================================
%% Template Matlab script to create an BIDS compatible _bold.json file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
% Use version of DICOM ontology terms whenever possible.
%
% DHermes, 2017

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
sample_label = '01';
chunk_label = '01';
stain_label = '03';
acq_label = 'Short';

name_spec.modality = 'micr';
name_spec.suffix = 'SEM';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'sample', sample_label, ...
                            'stain', stain_label, ...
                            'acq', acq_label, ...
                            'ses', ses_label, ...
                            'chunk', chunk_label);

% using the 'use_schema'; true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('Manufacturer');
fprintf(def.description);

% Image Acquisition
json.PixelSize = 'REQUIRED';
json.PixelSizeUnits = 'REQUIRED';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/micr/createBIDS_micr_json_short.m
================================================
%% Template Matlab script to create an BIDS compatible _bold.json file
% This example lists all required and optional fields.
% When adding additional metadata please use CamelCase
% Use version of DICOM ontology terms whenever possible.
%
% DHermes, 2017

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

%%

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
sample_label = '01';
chunk_label = '01';
stain_label = '03';
acq_label = 'Full';

name_spec.modality = 'micr';
name_spec.suffix = 'SEM';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'sample', sample_label, ...
                            'stain', stain_label, ...
                            'acq', acq_label, ...
                            'ses', ses_label, ...
                            'chunk', chunk_label);

% using the 'use_schema'; true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

%% Adding metadata
% to get the definition of each metadata,
% you can use the bids.Schema class from bids matlab

% For example
schema = bids.Schema;
def = schema.get_definition('Manufacturer');
fprintf(def.description);

% Device Hardware
json.Manufacturer = 'RECOMMENDED';
json.ManufacturersModelName = 'RECOMMENDED';
json.DeviceSerialNumber = 'RECOMMENDED';
json.StationName = 'RECOMMENDED';
json.SoftwareVersions = 'RECOMMENDED';
json.InstitutionName = 'RECOMMENDED';
json.InstitutionAddress = 'RECOMMENDED';
json.InstitutionalDepartmentName = 'RECOMMENDED';

% Image Acquisition
json.PixelSize = 'REQUIRED';
json.PixelSizeUnits = 'REQUIRED';
json.Immersion = 'OPTIONAL';
json.NumericalAperture = 'OPTIONAL';
json.Magnification = 'OPTIONAL';
json.ImageAcquisitionProtocol = 'OPTIONAL';
json.OtherAcquisitionParameters = 'OPTIONAL';

% Sample
json.BodyPart = 'RECOMMENDED';
json.BodyPartDetails = 'RECOMMENDED';
json.SampleEnvironment = 'RECOMMENDED';
json.SampleStaining = 'RECOMMENDED';
json.SamplePrimaryAntibody = 'RECOMMENDED';
json.SampleSecondaryAntibody = 'RECOMMENDED';
json.BodyPartDetailsOntology = 'OPTIONAL';
json.SampleEmbedding = 'OPTIONAL';
json.SampleFixation = 'OPTIONAL';
json.SliceThickness = 'OPTIONAL';
json.TissueDeformationScaling = 'OPTIONAL';
json.SampleExtractionProtocol = 'OPTIONAL';
json.SampleExtractionInstitution = 'OPTIONAL';

% Chunk
json.ChunkTransformationMatrix = 'RECOMMENDED if <chunk-index> is used in filenames';
json.ChunkTransformationMatrixAxis = 'REQUIRED if ChunkTransformationMatrix is present';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/miss_hit.cfg
================================================
# styly guide (https://florianschanda.github.io/miss_hit/style_checker.html)
line_length: 120

regex_function_name: "[a-zA-Z0-9]+(_[a-zA-Z0-9]+)*"
regex_parameter_name: "[a-z]+(_[a-z]+)*"
regex_script_name: "[a-zA-Z0-9]+(_[a-zA-Z0-9]+)*"

tab_width: 4

suppress_rule: "copyright_notice"

# metrics limit for the code quality (https://florianschanda.github.io/miss_hit/metrics.html)
metric "cnest": limit 7
metric "file_length": limit 400
metric "cyc": limit 70
metric "parameters": limit 6


================================================
FILE: matlabCode/pet/createBIDS_blood_auto_tsv_and_json_short.m
================================================
% Template Matlab script to create a BIDS compatible:
%
%   sub-01_ses-01_recording-AutosamplerShortExample_blood.tsv
%   sub-01_ses-01_recording-AutosamplerShortExample_blood.json
%
% This example lists all REQUIRED, RECOMMENDED and OPTIONAL fields.

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
recording_label = 'AutosamplerShortExample';

name_spec.modality = 'pet';
name_spec.suffix = 'blood';
name_spec.ext = '.tsv';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'recording', recording_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
tsv_file_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);
json_file_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.json_filename);

%% Write TSV
tsv.time = 0;
tsv.whole_blood_radioactivity = 0;

bids.util.tsvwrite(tsv_file_name, tsv);

%% Write JSON
% this makes the json look prettier when opened in a txt editor
json.PlasmaAvail = false;
json.WholeBloodAvail = true;
json.MetaboliteMethod = false;
json.DispersionCorrected = false;

% get the definition of each column,
% use the bids.Schema class from bids matlab
schema = bids.Schema;

def = schema.get_definition('time');
json.time.Description = def.description;
json.time.Unit = def.unit;

def = schema.get_definition('whole_blood_radioactivity');
json.whole_blood_radioactivity.Description = def.description;
json.whole_blood_radioactivity.Unit = def.unit;

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_file_name));
bids.util.jsonencode(json_file_name, json);


================================================
FILE: matlabCode/pet/createBIDS_blood_manual_tsv_and_json_full.m
================================================
% Template Matlab script to create a BIDS compatible:
%
%   sub-01_ses-01_recording-ManualFullExample_blood.tsv
%   sub-01_ses-01_recording-ManualFullExample_blood.json
%
% This example lists all REQUIRED, RECOMMENDED and OPTIONAL fields.

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
recording_label = 'ManualFullExample';

name_spec.modality = 'pet';
name_spec.suffix = 'blood';
name_spec.ext = '.tsv';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'recording', recording_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
tsv_file_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);
json_file_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.json_filename);

%% Write TSV
tsv.time = 0;
tsv.plasma_radioactivity = 0;
tsv.metabolite_parent_fraction = 0;
tsv.metabolite_polar_fraction = 0;
tsv.hplc_recovery_fractions = 0;
tsv.whole_blood_radioactivity = 0;

bids.util.tsvwrite(tsv_file_name, tsv);

%% Write JSON
json.PlasmaAvail = '';
json.MetaboliteAvail = '';
json.WholeBloodAvail = '';
json.DispersionCorrected = '';
json.WithdrawalRate = '';
json.TubingType = '';
json.TubingLength = '';
json.DispersionConstant = '';
json.Haematocrit = '';
json.BloodDensity = '';
json.PlasmaFreeFraction = '';
json.PlasmaFreeFractionMethod = '';
json.MetaboliteMethod = '';
json.MetaboliteRecoveryCorrectionApplied = '';

% get the definition of several columns,
% use the bids.Schema class from bids matlab
schema = bids.Schema;

columns = {'time'
           'plasma_radioactivity'
           'metabolite_parent_fraction'
           'metabolite_polar_fraction'
           'hplc_recovery_fractions'
           'whole_blood_radioactivity'};

for i = 1:numel(columns)
    def = schema.get_definition(columns{i});
    json.(columns{i}).Description = def.description;
    if isfield(def, 'unit')
        json.(columns{i}).Unit = def.unit;
    end
end

json.plasma_radioactivity.unit = 'kBq/ml';
json.whole_blood_radioactivity.unit = 'kBq/ml';
json.metabolite_parent_fraction.unit = 'unitless';
json.metabolite_polar_fraction.unit = 'unitless';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_file_name));
bids.util.jsonencode(json_file_name, json);


================================================
FILE: matlabCode/pet/createBIDS_blood_manual_tsv_and_json_short.m
================================================
% Template Matlab script to create a BIDS compatible:
%
%   sub-01_ses-01_recording-ManualFullExample_blood.tsv
%   sub-01_ses-01_recording-ManualFullExample_blood.json
%
% This example lists all REQUIRED, RECOMMENDED and OPTIONAL fields.

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
recording_label = 'ManualShortExample';

name_spec.modality = 'pet';
name_spec.suffix = 'blood';
name_spec.ext = '.tsv';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'recording', recording_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
tsv_file_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);
json_file_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.json_filename);

%% Write TSV
tsv.time = 0;
tsv.metabolite_parent_fraction = 0;

bids.util.tsvwrite(tsv_file_name, tsv);

%% Write JSON

% get the definition of each column,
% use the bids.Schema class from bids matlab
% example:
%
% schema = bids.Schema;
% def = schema.get_definition('metabolite_parent_fraction');

json.PlasmaAvail = '';
json.MetaboliteAvail = '';
json.WholeBloodAvail = '';
json.DispersionCorrected = '';
json.MetaboliteMethod = '';
json.MetaboliteRecoveryCorrectionApplied = '';
json.time = struct('Description', ...
                   'Time in relation to time zero defined by the _pet.json', ...
                   'Units', 's');
json.metabolite_parent_fraction = struct('Description', ...
                                         'Parent fraction of the radiotracer.', ...
                                         'Units', 'unitless');

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_file_name));
bids.util.jsonencode(json_file_name, json);


================================================
FILE: matlabCode/pet/createBIDS_pet_json_full.m
================================================
% Template Matlab script to create a BIDS compatible:
%
%   sub-01_ses-01_task-FullExample_pet.json
%
% This example lists all REQUIRED, RECOMMENDED and OPTIONAL fields.

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'FullExample';

name_spec.modality = 'pet';
name_spec.suffix = 'pet';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'task', task_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

% get the definition of each column,
% use the bids.Schema class from bids matlab
% example:
%
% schema = bids.Schema;
% def = schema.get_definition('TaskName');

json.TaskName = task_label;
json.Manufacturer = '';
json.ManufacturersModelName = '';
json.Units = '';
json.InstitutionName = '';
json.InstitutionAddress = '';
json.InstitutionalDepartmentName = '';
json.BodyPart = '';
json.TracerName = '';
json.TracerRadionuclide = '';
json.InjectedRadioactivity = '';
json.InjectedRadioactivityUnits = '';
json.InjectedMass = '';
json.InjectedMassUnits = '';
json.SpecificRadioactivity = '';
json.SpecificRadioactivityUnits = '';
json.ModeOfAdministration = '';
json.TracerRadLex = '';
json.TracerSNOMED = '';
json.TracerMolecularWeight = '';
json.TracerMolecularUnits = '';
json.InjectedMassPerWeight = '';
json.InjectedMassPerWeightUnits = '';
json.SpecificRadioactivityMeasTime = '';
json.MolarActivity = '';
json.MolarActivityUnits = '';
json.MolarActivityMeasTime = '';
json.InfusionRadioActivity = '';
json.InfusionStart = '';
json.InfusionSpeed = '';
json.InfusionSpeedUnits = '';
json.InjectedVolume = '';
json.Purity = '';
json.PharamceuticalName = '';
json.PharmaceuticalDoseAmount = [];
json.PharmaceuticalDoseUnits = '';
json.PharmaceuticalDoseRegimen = '';
json.PharmaceuticalDoseTime = [];
json.Anaesthesia = '';
json.TimeZero = '';
json.ScanStart = '';
json.InjectionStart = '';
json.FrameTimesStart = [];
json.FrameDuration = [];
json.ScanDate = '';
json.InjectionEnd = '';
json.AcquisitionMode = '';
json.ImageDecayCorrected = '';
json.ImageDecayCorrectionTime = '';
json.ReconMethodName = '';
json.ReconMethodParameterLabels = [];
json.ReconMethodParameterUnits = [];
json.ReconMethodParameterValues = [];
json.ReconFilterType = [];
json.ReconFilterSize = [];
json.AttenuationCorrection = '';
json.ReconMethodImplementationVersion = '';
json.AttenuationCorrectionMethodReference = '';
json.ScaleFactor = [];
json.ScatterFraction = [];
json.DecayCorrectionFactor = [];
json.PromptRate = [];
json.RandomRate = [];
json.SinglesRate = [];

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: matlabCode/pet/createBIDS_pet_json_short.m
================================================
% Template Matlab script to create a BIDS compatible:
%
%   sub-01_ses-01_task-ShortExample_pet.json
%
% This example lists all REQUIRED fields.

% Writing json files relies on the JSONio library
% https://github.com/bids-standard/bids-matlab
%
% Make sure it is in the matab/octave path
try
    bids.bids_matlab_version;
catch
    warning('%s\n%s\n%s\n%s', ...
            'Writing the JSON file seems to have failed.', ...
            'Make sure that the following library is in the matlab/octave path:', ...
            'https://github.com/bids-standard/bids-matlab');
end

clear;

this_dir = fileparts(mfilename('fullpath'));
root_dir = fullfile(this_dir, '..', filesep, '..');

project = 'templates';

sub_label = '01';
ses_label = '01';
task_label = 'ShortExample';

name_spec.modality = 'pet';
name_spec.suffix = 'pet';
name_spec.ext = '.json';
name_spec.entities = struct('sub', sub_label, ...
                            'ses', ses_label, ...
                            'task', task_label);

% using the 'use_schema', true
% ensures that the entities will be in the correct order
bids_file = bids.File(name_spec, 'use_schema', true);

% Contrust the fullpath version of the filename
json_name = fullfile(root_dir, project, bids_file.bids_path, bids_file.filename);

% get the definition of each column,
% use the bids.Schema class from bids matlab
% example:
%
% schema = bids.Schema;
% def = schema.get_definition('TaskName');

json.TaskName = task_label;
json.Manufacturer =  '';
json.ManufacturersModelName =  '';
json.Units =  '';
json.TracerName =  '';
json.TracerRadionuclide =  '';
json.InjectedRadioactivity =  '';
json.InjectedRadioactivityUnits =  '';
json.InjectedMass =  '';
json.InjectedMassUnits =  '';
json.SpecificRadioactivity =  '';
json.SpecificRadioactivityUnits =  '';
json.ModeOfAdministration =  '';
json.TimeZero =  '';
json.ScanStart =  '';
json.InjectionStart =  '';
json.FrameTimesStart =  [];
json.FrameDuration =  [];
json.AcquisitionMode =  '';
json.ImageDecayCorrected =  '';
json.ImageDecayCorrectionTime =  '';
json.ReconMethodName =  '';
json.ReconMethodParameterLabels =  [];
json.ReconMethodParameterUnits =  [];
json.ReconMethodParameterValues =  [];
json.ReconFilterType =  [];
json.ReconFilterSize =  [];
json.AttenuationCorrection =  '';

%% Write JSON
% Make sure the directory exists
bids.util.mkdir(fileparts(json_name));
bids.util.jsonencode(json_name, json);


================================================
FILE: pythonCode/createBIDS_MP2RAGE_json.py
================================================
"""
WARNING:
This script was created in October 2018 when the specification
for MP2RAGE files was not fully finalized. Please double check with
latest version of the specs to make sure this is accurate.

This script will create the JSON files required for an MP2RAGE file.
To function it requires a BIDS data set with properly named image files:
The script will go through all the folders of a BIDS data set and will create
the JSON files in every folder where it finds a file ending
with '_inv-1_part-mag_MPRAGE.nii.gz'.

Created by RG 2018-10-03
"""

import glob
import json
import os
from collections import OrderedDict

start_dir = ""  # insert here path to your BIDS data set

# DEFINE CONTENT OF JSON FILES

# defining the content of the JSON file for the
# first inversion image (sub-*_inv-1_MPRAGE.json)
data_inv_1 = OrderedDict([("InversionTime", "900"), ("FlipAngle", "5")])  # ms

# defining the content of the JSON file for the
# second inversion image (sub-*_inv-2_MPRAGE.json)
data_inv_2 = OrderedDict([("InversionTime", "2750"), ("FlipAngle", "3")])  # ms

# defining the content of the JSON files for the
# T1w (sub-*_T1w.json) and the T1map (sub-*_T1map.json)
data_T1 = OrderedDict(
    [
        ("EstimationMethod", "Marques et al., 2013"),
    ]
)

# defining the content of the main JSON file (sub-*_MPRAGE.json)
data_MP2RAGE = OrderedDict(
    [
        ("MagneticFieldStrength", ""),
        ("ExcitationRepetitionTime", ""),
        ("InversionRepetitionTime", ""),
        ("NumberShots", ""),
        ("Manufacturer", ""),
        ("ManufacturersModelName", ""),
        ("DeviceSerialNumber", ""),
        ("SoftwareVersions", ""),
        ("StationName", ""),
        ("InstitutionName", ""),
        ("InstitutionAddress", ""),
        ("InstitutionalDepartmentName", ""),
        ("ReceiveCoilName", ""),
        ("ReceiveCoilActiveElements", ""),
        ("GradientSetType", ""),
        ("MRTransmitCoilSequence", ""),
        ("MatrixCoilMode", ""),
        ("CoilCombinationMethod", ""),
        ("NonlinearGradientCorrection", ""),
        ("WaterFatShift", ""),
        ("EchoTrainLength", ""),
        ("DwellTime", ""),
        ("MultibandAccelerationFactor", ""),
        ("AnatomicalLandmarkCoordinates", ""),
        ("MRAcquisitionType", ""),
        ("ScanningSequence", ""),
        ("SequenceVariant", ""),
        ("ScanOptions", ""),
        ("SequenceName", ""),
        ("PulseSequenceType", "MP2RAGE"),
        ("PulseSequenceDetails", ""),
        ("ParallelReductionFactorInPlane", ""),
        ("ParallelAcquisitionTechnique", ""),
        ("PartialFourier", ""),
        ("PartialFourierDirection", ""),
        ("EffectiveEchoSpacing", ""),
        ("TotalReadoutTime", ""),
        ("PhaseEncodingDirection", ""),
        ("EchoTime1", ""),  # sec
        ("EchoTime2", ""),  # sec
        ("SliceThickness", ""),  # mm
    ]
)

# WRITE THEM
indent = 4

# list all subjects and  create iterator with full path for subjects folder
file_ls = glob.glob(
    os.path.join(start_dir, "sub*", "**", "*_inv-1_part-mag_MPRAGE.nii.gz"),
    recursive=True,
)

for f in file_ls:
    # creates the json files in the folder where the magnitude image
    # of the first inversion is found
    path, fname = os.path.split(f)

    #  define filename, excluding last three key-value pairs
    sid = "_".join(fname.split("_")[:-3])

    # adding content to JSON files for the T1w and T1map
    # as its content is subject dependent
    inv1_mag = os.path.join("anat", f"{sid}_inv1_part-mag_MPRAGE.nii.gz")
    inv1_phs = os.path.join("anat", f"{sid}_inv1_part-phase_MPRAGE.nii.gz")
    inv2_mag = os.path.join("anat", f"{sid}_inv2_part-mag_MPRAGE.nii.gz")
    inv2_phs = os.path.join("anat", f"{sid}_inv2_part-phase_MPRAGE.nii.gz")

    data_T1["BasedOn"] = f"{inv1_mag}, {inv1_phs}, {inv2_mag}, {inv2_phs}, "

    # define json files for all image types
    json_names = [
        "{}_inv-1_MPRAGE.json",
        "{}_inv-2_MPRAGE.json",
        "{}_MPRAGE.json",
        "{}_T1map.json",
        "{}_T1w.json",
    ]
    data_types = [data_inv_1, data_inv_2, data_MP2RAGE, data_T1, data_T1]
    out_files = zip(json_names, data_types)

    for out_file in out_files:
        json_name, data_type = out_file[0], out_file[1]
        with open(os.path.join(path, json_name.format(sid)), "w") as ff:
            json.dump(data_type, ff, sort_keys=False, indent=indent)


================================================
FILE: pythonCode/createBIDS_dataset_description_json.py
================================================
import json
from collections import OrderedDict

data = OrderedDict()
# General fields, shared with MRI BIDS and MEG BIDS:
# Required fields:
# name of the dataset
data["Name"] = ""

# The version of the BIDS standard that was used
data["BIDSVersion"] = "1.0.2"

# Recommended fields:
# what license is this dataset distributed under?
# The use of license name abbreviations is suggested for specifying a license.
# A list of common licenses with suggested abbreviations can be found in appendix III.
data["License"] = ""


# List of individuals who con
Download .txt
gitextract_ajxyoq0h/

├── .all-contributorsrc
├── .github/
│   └── workflows/
│       └── deploy_book.yml
├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── interactiveTreeVisualization/
│   └── epilepsyClassification2017/
│       ├── tree.html
│       ├── treeData.js
│       ├── treeFunctions.js
│       └── treeStyle.css
├── matlabCode/
│   ├── anat/
│   │   ├── createBIDS_T1w_json_full.m
│   │   ├── createBIDS_T1w_json_full_schma_based.m
│   │   └── createBIDS_T1w_json_short.m
│   ├── eeg-meg/
│   │   ├── createBIDS_meg_json_full.m
│   │   ├── createBIDS_meg_json_short.m
│   │   └── rename_brainvision_files.m
│   ├── fmap/
│   │   └── createBIDS_fmap_json.m
│   ├── func/
│   │   ├── createBIDS_bold_json_full.m
│   │   └── createBIDS_bold_json_short.m
│   ├── general/
│   │   ├── README.md
│   │   ├── bids_spreadsheet2participants.m
│   │   ├── createBIDS_dataset_description_json.m
│   │   ├── createBIDS_events_tsv_json_full.m
│   │   ├── createBIDS_participants_tsv.m
│   │   ├── createBIDS_samples_tsv.m
│   │   ├── input/
│   │   │   └── spreadsheet_to_convert.xlsx
│   │   └── tests/
│   │       ├── data/
│   │       │   ├── participants.json
│   │       │   └── participants.tsv
│   │       └── test_bids_spreadsheet2participants.m
│   ├── ieeg/
│   │   ├── createBIDS_channels_tsv.m
│   │   ├── createBIDS_coordsystem_json.m
│   │   ├── createBIDS_data_WriteBrainVisionWithFieldtrip.m
│   │   ├── createBIDS_electrodes_tsv.m
│   │   └── createBIDS_ieeg_json.m
│   ├── micr/
│   │   ├── createBIDS_micr_json_full.m
│   │   └── createBIDS_micr_json_short.m
│   ├── miss_hit.cfg
│   └── pet/
│       ├── createBIDS_blood_auto_tsv_and_json_short.m
│       ├── createBIDS_blood_manual_tsv_and_json_full.m
│       ├── createBIDS_blood_manual_tsv_and_json_short.m
│       ├── createBIDS_pet_json_full.m
│       └── createBIDS_pet_json_short.m
├── pythonCode/
│   ├── createBIDS_MP2RAGE_json.py
│   └── createBIDS_dataset_description_json.py
├── reports/
│   └── Google-2018-report.md
├── src/
│   ├── CONTRIBUTING.md
│   ├── _config.yml
│   ├── _toc.yml
│   ├── epilepsy_phenotype.rst
│   ├── index.md
│   ├── references.bib
│   └── tree.html
└── templates/
    ├── participants.json
    ├── participants.tsv
    ├── phenotype/
    │   ├── EpilepsyClassification.tsv
    │   └── EpilepsyClassification2017.json
    ├── samples.json
    ├── samples.tsv
    ├── sub-01/
    │   └── ses-01/
    │       ├── anat/
    │       │   ├── sub-01_ses-01_acq-FullExample_run-01_T1w.json
    │       │   └── sub-01_ses-01_acq-ShortExample_run-01_T1w.json
    │       ├── eeg/
    │       │   ├── sub-01_ses-01_task-FilterExample_eeg.json
    │       │   ├── sub-01_ses-01_task-FullExample_eeg.json
    │       │   ├── sub-01_ses-01_task-MinimalExample_eeg.json
    │       │   └── sub-01_ses-01_task-ReferenceExample_eeg.json
    │       ├── fmap/
    │       │   ├── sub-01_ses-01_acq-Case1_run-01_phasediff.json
    │       │   ├── sub-01_ses-01_acq-Case2_run-01_phase1.json
    │       │   ├── sub-01_ses-01_acq-Case2_run-01_phase2.json
    │       │   ├── sub-01_ses-01_acq-Case3_run-01_fieldmap.json
    │       │   └── sub-01_ses-01_acq-Case4_dir-LR_run-01_epi.json
    │       ├── func/
    │       │   ├── sub-01_ses-01_task-FullExample_run-01_bold.json
    │       │   ├── sub-01_ses-01_task-FullExample_run-01_events.json
    │       │   ├── sub-01_ses-01_task-FullExample_run-01_events.tsv
    │       │   └── sub-01_ses-01_task-ShortExample_run-01_bold.json
    │       ├── ieeg/
    │       │   ├── sub-01_ses-01_coordsystem.json
    │       │   ├── sub-01_ses-01_electrodes.tsv
    │       │   ├── sub-01_ses-01_task-LongExample_run-01_channels.tsv
    │       │   └── sub-01_ses-01_task-LongExample_run-01_ieeg.json
    │       ├── meg/
    │       │   ├── sub-01_ses-01_task-FullExample_acq-CTF_run-1_proc-sss_meg.json
    │       │   └── sub-01_ses-01_task-ShortExample_acq-CTF_run-1_proc-sss_meg.json
    │       ├── micr/
    │       │   ├── sub-01_ses-01_sample-01_acq-Full_stain-03_chunk-01_SEM.json
    │       │   └── sub-01_ses-01_sample-01_acq-Short_stain-03_chunk-01_SEM.json
    │       └── pet/
    │           ├── sub-01_ses-01_recording-AutosamplerShortExample_blood.json
    │           ├── sub-01_ses-01_recording-AutosamplerShortExample_blood.tsv
    │           ├── sub-01_ses-01_recording-ManualFullExample_blood.json
    │           ├── sub-01_ses-01_recording-ManualFullExample_blood.tsv
    │           ├── sub-01_ses-01_recording-ManualShortExample_blood.json
    │           ├── sub-01_ses-01_recording-ManualShortExample_blood.tsv
    │           ├── sub-01_ses-01_task-FullExample_pet.json
    │           └── sub-01_ses-01_task-ShortExample_pet.json
    └── sub-epilepsy01/
        └── ses-01/
            └── ieeg/
                ├── sub-epilepsy01_ses-01_electrodes.json
                └── sub-epilepsy01_ses-01_electrodes.tsv
Download .txt
SYMBOL INDEX (9 symbols across 1 files)

FILE: interactiveTreeVisualization/epilepsyClassification2017/treeFunctions.js
  function update (line 53) | function update(source) {
  function click (line 192) | function click(d) {
  function expand (line 203) | function expand(d) {
  function collapse (line 213) | function collapse(d) {
  function expandAll (line 221) | function expandAll() {
  function collapseAll (line 226) | function collapseAll() {
  function save (line 238) | function save(dataBlob, filesize) {
  function getSVGString (line 246) | function getSVGString(svgNode) {
  function svgString2Image (line 316) | function svgString2Image(svgString, width, height, format, callback) {
Condensed preview — 91 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (278K chars).
[
  {
    "path": ".all-contributorsrc",
    "chars": 11590,
    "preview": "{\n  \"files\": [\n    \"README.md\"\n  ],\n  \"imageSize\": 100,\n  \"commit\": false,\n  \"contributors\": [\n    {\n      \"login\": \"dor"
  },
  {
    "path": ".github/workflows/deploy_book.yml",
    "chars": 948,
    "preview": "---\nname: deploy-book\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\n# Only"
  },
  {
    "path": ".gitignore",
    "chars": 3634,
    "preview": ".vscode/\n\n.DS_Store\n\nsrc/_build\n\ndesktop.ini\n\n.idea/\n\n# ----------------------------------------------------------------"
  },
  {
    "path": "LICENSE",
    "chars": 18646,
    "preview": "Attribution 4.0 International\n\n=======================================================================\n\nCreative Commons"
  },
  {
    "path": "Makefile",
    "chars": 869,
    "preview": ".PHONY: all clean\n\ndefine BROWSER_PYSCRIPT\nimport os, webbrowser, sys\n\nfrom urllib.request import pathname2url\n\nwebbrows"
  },
  {
    "path": "README.md",
    "chars": 17351,
    "preview": "<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io"
  },
  {
    "path": "interactiveTreeVisualization/epilepsyClassification2017/tree.html",
    "chars": 1846,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <meta charset=\"utf-8\">\n\n    <title>ILAE classification of the epilepsies Tr"
  },
  {
    "path": "interactiveTreeVisualization/epilepsyClassification2017/treeData.js",
    "chars": 27800,
    "preview": "var treeData = [{\n    \"name\": \"Epilepsy Classification\",\n    \"parent\": \"null\",\n    \"_children\": [\n\n        // ****** Sei"
  },
  {
    "path": "interactiveTreeVisualization/epilepsyClassification2017/treeFunctions.js",
    "chars": 9729,
    "preview": "// ************** Generate the tree diagram\t *****************\n\nvar margin = {\n        top: 50,\n        right: 150,\n    "
  },
  {
    "path": "interactiveTreeVisualization/epilepsyClassification2017/treeStyle.css",
    "chars": 550,
    "preview": "\n.node {\n    cursor: pointer;\n}\n\n.node circle {\n    fill: #fff;\n    stroke: steelblue;\n    stroke-width: 3px;\n}\n\n.node t"
  },
  {
    "path": "matlabCode/anat/createBIDS_T1w_json_full.m",
    "chars": 3598,
    "preview": "% Template Matlab script to create a BIDS compatible file:\n%\n%  sub-01_ses-01_run-01_acq-FullExample_T1w.json\n%\n% This e"
  },
  {
    "path": "matlabCode/anat/createBIDS_T1w_json_full_schma_based.m",
    "chars": 2162,
    "preview": "% Similar to \"createBIDS_T1w_json_full.m\"\n% but relies on the BIDS schema to get a more updated version\n% of the list of"
  },
  {
    "path": "matlabCode/anat/createBIDS_T1w_json_short.m",
    "chars": 2308,
    "preview": "% Template Matlab script to create a BIDS compatible file:\n%\n%  sub-01_ses-01_acq-ShortExample_run-01_T1w.json\n%\n% This "
  },
  {
    "path": "matlabCode/eeg-meg/createBIDS_meg_json_full.m",
    "chars": 3985,
    "preview": "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% Create JSON using MATLAB for MEG BIDS:\n%\n% This template is f"
  },
  {
    "path": "matlabCode/eeg-meg/createBIDS_meg_json_short.m",
    "chars": 2861,
    "preview": "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% Create JSON using MATLAB for MEG BIDS:\n%\n% This template is f"
  },
  {
    "path": "matlabCode/eeg-meg/rename_brainvision_files.m",
    "chars": 4979,
    "preview": "function rename_brainvision_files(varargin)\n\n    % RENAME_BRAINVISION_FILES renames a BrainVision EEG dataset, which con"
  },
  {
    "path": "matlabCode/fmap/createBIDS_fmap_json.m",
    "chars": 6644,
    "preview": "%% Template Matlab script to create an BIDS compatible _fmap.json file\n% There are different cases, see BIDS spec 1.0.2 "
  },
  {
    "path": "matlabCode/func/createBIDS_bold_json_full.m",
    "chars": 3709,
    "preview": "%% Template Matlab script to create an BIDS compatible _bold.json file\n% This example lists all required and optional fi"
  },
  {
    "path": "matlabCode/func/createBIDS_bold_json_short.m",
    "chars": 2024,
    "preview": "%% Template Matlab script to create an BIDS compatible _bold.json file\n% This example only lists the required fields.\n% "
  },
  {
    "path": "matlabCode/general/README.md",
    "chars": 358,
    "preview": "# Code to generate \"modality agnostic\" BIDS files\n\n## bids_spreadsheet2participants\n\nThis function requires Matlab 2018a"
  },
  {
    "path": "matlabCode/general/bids_spreadsheet2participants.m",
    "chars": 18069,
    "preview": "function files_out = bids_spreadsheet2participants(varargin)\n    %\n    % routine to takes an spreadsheet file (for examp"
  },
  {
    "path": "matlabCode/general/createBIDS_dataset_description_json.m",
    "chars": 2500,
    "preview": "%% Template Matlab script to create an BIDS compatible dataset_description.json file\n% This example lists all required a"
  },
  {
    "path": "matlabCode/general/createBIDS_events_tsv_json_full.m",
    "chars": 3911,
    "preview": "%% Template Matlab script to create an BIDS compatible sub-01_ses-01_task-FullExample-01_events.tsv file\n% This example "
  },
  {
    "path": "matlabCode/general/createBIDS_participants_tsv.m",
    "chars": 2097,
    "preview": "%% Template Matlab script to create an BIDS compatible participants.tsv file\n% This example lists all required and optio"
  },
  {
    "path": "matlabCode/general/createBIDS_samples_tsv.m",
    "chars": 1435,
    "preview": "%% Template Matlab script to create an BIDS compatible samples.tsv file\n\n% Writing json files relies on the JSONio libra"
  },
  {
    "path": "matlabCode/general/tests/data/participants.json",
    "chars": 549,
    "preview": "{\r\n \"collectionIssues\": {\r\n  \"Description\": [],\r\n  \"Levels\": [\r\n   \"broken trigger cable, no EEG codes\",\r\n   \"nill\",\r\n  "
  },
  {
    "path": "matlabCode/general/tests/data/participants.tsv",
    "chars": 915,
    "preview": "participant_id\tcollectionIssues\tCognitiveTest1\tCognitiveTest2\ttestdate\tage\tsex\r\nsub-control1\tnone\t8\t1\t01-Nov-2019\tn/a\tni"
  },
  {
    "path": "matlabCode/general/tests/test_bids_spreadsheet2participants.m",
    "chars": 658,
    "preview": "% requires:\n% - moxunit: https://github.com/MOxUnit/MOxUnit\n% - bids-matlab\n\naddpath(fullfile(pwd, '..'));\n\ninput_file ="
  },
  {
    "path": "matlabCode/ieeg/createBIDS_channels_tsv.m",
    "chars": 4083,
    "preview": "%% Template Matlab script to create an BIDS compatible electrodes.tsv file\n% This example lists all required and optiona"
  },
  {
    "path": "matlabCode/ieeg/createBIDS_coordsystem_json.m",
    "chars": 2056,
    "preview": "%% Template Matlab script to create an BIDS compatible _electrodes.json file\n% For BIDS-iEEG\n% This example lists all re"
  },
  {
    "path": "matlabCode/ieeg/createBIDS_data_WriteBrainVisionWithFieldtrip.m",
    "chars": 2024,
    "preview": "% %%%%% save data as BrainVision BIDS %%%%%\n%\n% Sample script that calls Fieldtrip functions to write a Brainvision data"
  },
  {
    "path": "matlabCode/ieeg/createBIDS_electrodes_tsv.m",
    "chars": 1869,
    "preview": "%% Template Matlab script to create an BIDS compatible electrodes.tsv file\n% This example lists all required and optiona"
  },
  {
    "path": "matlabCode/ieeg/createBIDS_ieeg_json.m",
    "chars": 3329,
    "preview": "%% Template Matlab script to create an BIDS compatible _ieeg.json file\n% This example lists all required and optional fi"
  },
  {
    "path": "matlabCode/micr/createBIDS_micr_json_full.m",
    "chars": 2039,
    "preview": "%% Template Matlab script to create an BIDS compatible _bold.json file\n% This example lists all required and optional fi"
  },
  {
    "path": "matlabCode/micr/createBIDS_micr_json_short.m",
    "chars": 3280,
    "preview": "%% Template Matlab script to create an BIDS compatible _bold.json file\n% This example lists all required and optional fi"
  },
  {
    "path": "matlabCode/miss_hit.cfg",
    "chars": 490,
    "preview": "# styly guide (https://florianschanda.github.io/miss_hit/style_checker.html)\nline_length: 120\n\nregex_function_name: \"[a-"
  },
  {
    "path": "matlabCode/pet/createBIDS_blood_auto_tsv_and_json_short.m",
    "chars": 2323,
    "preview": "% Template Matlab script to create a BIDS compatible:\n%\n%   sub-01_ses-01_recording-AutosamplerShortExample_blood.tsv\n% "
  },
  {
    "path": "matlabCode/pet/createBIDS_blood_manual_tsv_and_json_full.m",
    "chars": 2992,
    "preview": "% Template Matlab script to create a BIDS compatible:\n%\n%   sub-01_ses-01_recording-ManualFullExample_blood.tsv\n%   sub-"
  },
  {
    "path": "matlabCode/pet/createBIDS_blood_manual_tsv_and_json_short.m",
    "chars": 2468,
    "preview": "% Template Matlab script to create a BIDS compatible:\n%\n%   sub-01_ses-01_recording-ManualFullExample_blood.tsv\n%   sub-"
  },
  {
    "path": "matlabCode/pet/createBIDS_pet_json_full.m",
    "chars": 3478,
    "preview": "% Template Matlab script to create a BIDS compatible:\n%\n%   sub-01_ses-01_task-FullExample_pet.json\n%\n% This example lis"
  },
  {
    "path": "matlabCode/pet/createBIDS_pet_json_short.m",
    "chars": 2414,
    "preview": "% Template Matlab script to create a BIDS compatible:\n%\n%   sub-01_ses-01_task-ShortExample_pet.json\n%\n% This example li"
  },
  {
    "path": "pythonCode/createBIDS_MP2RAGE_json.py",
    "chars": 4405,
    "preview": "\"\"\"\nWARNING:\nThis script was created in October 2018 when the specification\nfor MP2RAGE files was not fully finalized. P"
  },
  {
    "path": "pythonCode/createBIDS_dataset_description_json.py",
    "chars": 1517,
    "preview": "import json\nfrom collections import OrderedDict\n\ndata = OrderedDict()\n# General fields, shared with MRI BIDS and MEG BID"
  },
  {
    "path": "reports/Google-2018-report.md",
    "chars": 8331,
    "preview": "This is Patrick Park's Google Summer of Code final report for his work on the\n[BIDS Starter Kit](https://github.com/bids"
  },
  {
    "path": "src/CONTRIBUTING.md",
    "chars": 5086,
    "preview": "# Contributing\n\n🐣 **We're so excited you're here and want to contribute.** 🐣\n\nThe point of this starter kit is to **welc"
  },
  {
    "path": "src/_config.yml",
    "chars": 6833,
    "preview": "---\n#######################################################################################\n# A default configuration th"
  },
  {
    "path": "src/_toc.yml",
    "chars": 2238,
    "preview": "---\nformat: jb-book\nroot: index.md\nparts:\n- caption: Folders and files\n  chapters:\n  - title: Folders\n    url: https://b"
  },
  {
    "path": "src/epilepsy_phenotype.rst",
    "chars": 132,
    "preview": ".. only:: html\n\n    ===================\n    Epilepsy phenotypes\n    ===================\n\n    .. raw:: html\n        :file"
  },
  {
    "path": "src/index.md",
    "chars": 2494,
    "preview": "---\njupyter:\n    jupytext:\n        text_representation:\n        format_name: myst\n    kernelspec:\n        display_name: "
  },
  {
    "path": "src/references.bib",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/tree.html",
    "chars": 2539,
    "preview": "<div class=\"App\">\n\n    <style>\n        .node {\n            cursor: pointer;\n        }\n\n        .node circle {\n          "
  },
  {
    "path": "templates/participants.json",
    "chars": 773,
    "preview": "{\n  \"age\": {\n    \"LongName\": \"\",\n    \"Description\": \"age of the participant\",\n    \"Levels\": {\n    },\n    \"Units\": \"years"
  },
  {
    "path": "templates/participants.tsv",
    "chars": 69,
    "preview": "participant_id\tage\tsex\thandedness\nsub-01\t0\tm\tl\nsub-epilepsy01\t10\tf\tr\n"
  },
  {
    "path": "templates/phenotype/EpilepsyClassification.tsv",
    "chars": 408,
    "preview": "participant_id\tseizure_type\tepilepsy_type\tepilepsy_syndrome\tetiology\nsub-01\t/Generalised/NonMotor/AtypicalAbsence, /Gene"
  },
  {
    "path": "templates/phenotype/EpilepsyClassification2017.json",
    "chars": 16254,
    "preview": "{\n    \"epilepsy_classification\": {\n        \"LongName\": \"Epilepsy Classification\",\n        \"Description\": \"ILAE classific"
  },
  {
    "path": "templates/samples.json",
    "chars": 549,
    "preview": "{\n  \"sample_id\": {\n    \"LongName\": \"Sample ID\",\n    \"Description\": \"A sample identifier of the form `sample-<label>`,\\nm"
  },
  {
    "path": "templates/samples.tsv",
    "chars": 93,
    "preview": "sample_id\tparticipant_id\tsample_type\nsample-01\tsub-01\ttissue\nsample-02\tsub-epilepsy01\ttissue\n"
  },
  {
    "path": "templates/sub-01/ses-01/anat/sub-01_ses-01_acq-FullExample_run-01_T1w.json",
    "chars": 1080,
    "preview": "{\n  \"Manufacturer\": \" \",\n  \"ManufacturersModelName\": \" \",\n  \"MagneticFieldStrength\": \" \",\n  \"DeviceSerialNumber\": \" \",\n "
  },
  {
    "path": "templates/sub-01/ses-01/anat/sub-01_ses-01_acq-ShortExample_run-01_T1w.json",
    "chars": 113,
    "preview": "{\n  \"PhaseEncodingDirection\": \" \",\n  \"EffectiveEchoSpacing\": \" \",\n  \"TotalReadoutTime\": \" \",\n  \"EchoTime\": \" \"\n}\n"
  },
  {
    "path": "templates/sub-01/ses-01/eeg/sub-01_ses-01_task-FilterExample_eeg.json",
    "chars": 227,
    "preview": "{\n    \"HardwareFilters\": {\n        \"Highpass RC filter\": {\n            \"Half amplitude cutoff (Hz)\": 0.0159,\n           "
  },
  {
    "path": "templates/sub-01/ses-01/eeg/sub-01_ses-01_task-FullExample_eeg.json",
    "chars": 936,
    "preview": "{\n    \"TaskName\": \"FullExample\",\n    \"TaskDescription\": \"\",\n    \"Instructions\": \"\",\n    \"CogAtlasID\": \"https://www.cogni"
  },
  {
    "path": "templates/sub-01/ses-01/eeg/sub-01_ses-01_task-MinimalExample_eeg.json",
    "chars": 228,
    "preview": "{\n    \"TaskName\": \"MinimalExample\",\n    \"SamplingFrequency\": [],\n    \"EEGChannelCount\": [],\n    \"EOGChannelCount\": [],\n "
  },
  {
    "path": "templates/sub-01/ses-01/eeg/sub-01_ses-01_task-ReferenceExample_eeg.json",
    "chars": 192,
    "preview": "{\n    \"Manufacturer\": \"Biosemi\",\n    \"ManufacturersModelName\": \"ActiveTwo\",\n    \"EEGReference\": \"CMS, placed on Cz\",\n   "
  },
  {
    "path": "templates/sub-01/ses-01/fmap/sub-01_ses-01_acq-Case1_run-01_phasediff.json",
    "chars": 124,
    "preview": "{\n  \"EchoTime1\": \"\",\n  \"EchoTime2\": \"\",\n  \"IntendedFor\": [\n    \"sub-01/ses-01/func/...\",\n    \"sub-01/ses-01/func/...\"\n  "
  },
  {
    "path": "templates/sub-01/ses-01/fmap/sub-01_ses-01_acq-Case2_run-01_phase1.json",
    "chars": 104,
    "preview": "{\n  \"EchoTime\": \"\",\n  \"IntendedFor\": [\n    \"sub-01/ses-01/func/...\",\n    \"sub-01/ses-01/func/...\"\n  ]\n}\n"
  },
  {
    "path": "templates/sub-01/ses-01/fmap/sub-01_ses-01_acq-Case2_run-01_phase2.json",
    "chars": 104,
    "preview": "{\n  \"EchoTime\": \"\",\n  \"IntendedFor\": [\n    \"sub-01/ses-01/func/...\",\n    \"sub-01/ses-01/func/...\"\n  ]\n}\n"
  },
  {
    "path": "templates/sub-01/ses-01/fmap/sub-01_ses-01_acq-Case3_run-01_fieldmap.json",
    "chars": 101,
    "preview": "{\n  \"Units\": \"\",\n  \"IntendedFor\": [\n    \"sub-01/ses-01/func/...\",\n    \"sub-01/ses-01/func/...\"\n  ]\n}\n"
  },
  {
    "path": "templates/sub-01/ses-01/fmap/sub-01_ses-01_acq-Case4_dir-LR_run-01_epi.json",
    "chars": 144,
    "preview": "{\n  \"PhaseEncodingDirection\": \"\",\n  \"TotalReadoutTime\": \"\",\n  \"IntendedFor\": [\n    \"sub-01/ses-01/func/...\",\n    \"sub-01"
  },
  {
    "path": "templates/sub-01/ses-01/func/sub-01_ses-01_task-FullExample_run-01_bold.json",
    "chars": 1429,
    "preview": "{\n  \"TaskName\": \"FullExample\",\n  \"RepetitionTime\": [],\n  \"PhaseEncodingDirection\": \"\",\n  \"EffectiveEchoSpacing\": [],\n  \""
  },
  {
    "path": "templates/sub-01/ses-01/func/sub-01_ses-01_task-FullExample_run-01_events.json",
    "chars": 644,
    "preview": "{\n  \"trial_type\": {\n    \"LongName\": \"\",\n    \"Description\": \"Emotion image type\",\n    \"Levels\": {\n      \"afraid\": \"A face"
  },
  {
    "path": "templates/sub-01/ses-01/func/sub-01_ses-01_task-FullExample_run-01_events.tsv",
    "chars": 67,
    "preview": "onset\tduration\ttrial_type\tresponse_time\tstim_file\tHED\n0\t0\tafraid\t0\n"
  },
  {
    "path": "templates/sub-01/ses-01/func/sub-01_ses-01_task-ShortExample_run-01_bold.json",
    "chars": 228,
    "preview": "{\n  \"TaskName\": \"ShortExample\",\n  \"RepetitionTime\": [],\n  \"VolumeTiming\": [],\n  \"DelayTime\": [],\n  \"SliceTiming\": [],\n  "
  },
  {
    "path": "templates/sub-01/ses-01/ieeg/sub-01_ses-01_coordsystem.json",
    "chars": 215,
    "preview": "{\n  \"iEEGCoordinateSystem\": \"\",\n  \"iEEGCoordinateUnits\": \"\",\n  \"iEEGCoordinateProcessingDescripton\": \"\",\n  \"IndendedFor\""
  },
  {
    "path": "templates/sub-01/ses-01/ieeg/sub-01_ses-01_electrodes.tsv",
    "chars": 106,
    "preview": "name\tx\ty\tz\tsize\tmaterial\tmanufacturer\tgroup\themisphere\ttype\timpedance\nn/a\t0\t0\t0\t0\tn/a\tn/a\tn/a\tn/a\tn/a\tn/a\n"
  },
  {
    "path": "templates/sub-01/ses-01/ieeg/sub-01_ses-01_task-LongExample_run-01_channels.tsv",
    "chars": 158,
    "preview": "name\ttype\tunits\tlow_cutoff\thigh_cutoff\treference\tgroup\tsampling_frequency\tdescription\tnotch\tstatus\tstatus_description\nn/"
  },
  {
    "path": "templates/sub-01/ses-01/ieeg/sub-01_ses-01_task-LongExample_run-01_ieeg.json",
    "chars": 1147,
    "preview": "{\n  \"TaskName\": \"LongExample\",\n  \"SamplingFrequency\": [],\n  \"PowerLineFrequency\": [],\n  \"SoftwareFilters\": \"\",\n  \"Hardwa"
  },
  {
    "path": "templates/sub-01/ses-01/meg/sub-01_ses-01_task-FullExample_acq-CTF_run-1_proc-sss_meg.json",
    "chars": 1069,
    "preview": "{\n  \"TaskName\": \"FullExample\",\n  \"InstitutionName\": \"\",\n  \"InstitutionAddress\": \"\",\n  \"Manufacturer\": \"\",\n  \"Manufacture"
  },
  {
    "path": "templates/sub-01/ses-01/meg/sub-01_ses-01_task-ShortExample_acq-CTF_run-1_proc-sss_meg.json",
    "chars": 1070,
    "preview": "{\n  \"TaskName\": \"ShortExample\",\n  \"InstitutionName\": \"\",\n  \"InstitutionAddress\": \"\",\n  \"Manufacturer\": \"\",\n  \"Manufactur"
  },
  {
    "path": "templates/sub-01/ses-01/micr/sub-01_ses-01_sample-01_acq-Full_stain-03_chunk-01_SEM.json",
    "chars": 1210,
    "preview": "{\n  \"Manufacturer\": \"RECOMMENDED\",\n  \"ManufacturersModelName\": \"RECOMMENDED\",\n  \"DeviceSerialNumber\": \"RECOMMENDED\",\n  \""
  },
  {
    "path": "templates/sub-01/ses-01/micr/sub-01_ses-01_sample-01_acq-Short_stain-03_chunk-01_SEM.json",
    "chars": 62,
    "preview": "{\n  \"PixelSize\": \"REQUIRED\",\n  \"PixelSizeUnits\": \"REQUIRED\"\n}\n"
  },
  {
    "path": "templates/sub-01/ses-01/pet/sub-01_ses-01_recording-AutosamplerShortExample_blood.json",
    "chars": 382,
    "preview": "{\n  \"PlasmaAvail\": false,\n  \"WholeBloodAvail\": true,\n  \"MetaboliteMethod\": false,\n  \"DispersionCorrected\": false,\n  \"tim"
  },
  {
    "path": "templates/sub-01/ses-01/pet/sub-01_ses-01_recording-AutosamplerShortExample_blood.tsv",
    "chars": 35,
    "preview": "time\twhole_blood_radioactivity\n0\t0\n"
  },
  {
    "path": "templates/sub-01/ses-01/pet/sub-01_ses-01_recording-ManualFullExample_blood.json",
    "chars": 1317,
    "preview": "{\n  \"PlasmaAvail\": \"\",\n  \"MetaboliteAvail\": \"\",\n  \"WholeBloodAvail\": \"\",\n  \"DispersionCorrected\": \"\",\n  \"WithdrawalRate\""
  },
  {
    "path": "templates/sub-01/ses-01/pet/sub-01_ses-01_recording-ManualFullExample_blood.tsv",
    "chars": 141,
    "preview": "time\tplasma_radioactivity\tmetabolite_parent_fraction\tmetabolite_polar_fraction\thplc_recovery_fractions\twhole_blood_radio"
  },
  {
    "path": "templates/sub-01/ses-01/pet/sub-01_ses-01_recording-ManualShortExample_blood.json",
    "chars": 406,
    "preview": "{\n  \"PlasmaAvail\": \"\",\n  \"MetaboliteAvail\": \"\",\n  \"WholeBloodAvail\": \"\",\n  \"DispersionCorrected\": \"\",\n  \"MetaboliteMetho"
  },
  {
    "path": "templates/sub-01/ses-01/pet/sub-01_ses-01_recording-ManualShortExample_blood.tsv",
    "chars": 36,
    "preview": "time\tmetabolite_parent_fraction\n0\t0\n"
  },
  {
    "path": "templates/sub-01/ses-01/pet/sub-01_ses-01_task-FullExample_pet.json",
    "chars": 1767,
    "preview": "{\n  \"TaskName\": \"FullExample\",\n  \"Manufacturer\": \"\",\n  \"ManufacturersModelName\": \"\",\n  \"Units\": \"\",\n  \"InstitutionName\":"
  },
  {
    "path": "templates/sub-01/ses-01/pet/sub-01_ses-01_task-ShortExample_pet.json",
    "chars": 773,
    "preview": "{\n  \"TaskName\": \"ShortExample\",\n  \"Manufacturer\": \"\",\n  \"ManufacturersModelName\": \"\",\n  \"Units\": \"\",\n  \"TracerName\": \"\","
  },
  {
    "path": "templates/sub-epilepsy01/ses-01/ieeg/sub-epilepsy01_ses-01_electrodes.json",
    "chars": 1430,
    "preview": "{\n    \"name\": {\n        \"Description\": \"REQUIRED. Name of the electrode contact point.\"\n    },\n    \"x\": {\n        \"Descr"
  },
  {
    "path": "templates/sub-epilepsy01/ses-01/ieeg/sub-epilepsy01_ses-01_electrodes.tsv",
    "chars": 74,
    "preview": "name\tx\ty\tz\tsize\tseizure_zone\nTO1\t0\t0\t0\t5\tNonSOZ\nTO2\t0\t0\t0\t5\tSOZ, Resected\n"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the bids-standard/bids-starter-kit GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 91 files (251.4 KB), approximately 65.0k tokens, and a symbol index with 9 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!