diff --git a/bids-validator/package.json b/bids-validator/package.json index cb856049b..9f0e8fb22 100644 --- a/bids-validator/package.json +++ b/bids-validator/package.json @@ -30,6 +30,7 @@ "hed-validator": "^2.0.1", "ignore": "^4.0.2", "is-utf8": "^0.2.1", + "js-yaml": "^3.14.0", "jshint": "^2.9.6", "lerna": "^3.15.0", "minimatch": "3.0.4", diff --git a/bids-validator/schemas/associated_data.yaml b/bids-validator/schemas/associated_data.yaml new file mode 100644 index 000000000..b54ca34fb --- /dev/null +++ b/bids-validator/schemas/associated_data.yaml @@ -0,0 +1,9 @@ +--- +- code/: + - required: false +- derivatives/: + - required: false +- sourcedata/: + - required: false +- stimuli/: + - required: false diff --git a/bids-validator/schemas/auxdatatypes/channels.yaml b/bids-validator/schemas/auxdatatypes/channels.yaml new file mode 100644 index 000000000..f5b412824 --- /dev/null +++ b/bids-validator/schemas/auxdatatypes/channels.yaml @@ -0,0 +1,16 @@ +--- +- datatypes: + - meg + - eeg + - ieeg + suffixes: + - channels + extensions: + - .json + - .tsv + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional diff --git a/bids-validator/schemas/auxdatatypes/electrodes.yaml b/bids-validator/schemas/auxdatatypes/electrodes.yaml new file mode 100644 index 000000000..b630ad589 --- /dev/null +++ b/bids-validator/schemas/auxdatatypes/electrodes.yaml @@ -0,0 +1,14 @@ +--- +- datatypes: + - eeg + - ieeg + suffixes: + - electrodes + extensions: + - .json + - .tsv + entities: + sub: required + ses: optional + acq: optional + space: optional diff --git a/bids-validator/schemas/auxdatatypes/events.yaml b/bids-validator/schemas/auxdatatypes/events.yaml new file mode 100644 index 000000000..34a0d7943 --- /dev/null +++ b/bids-validator/schemas/auxdatatypes/events.yaml @@ -0,0 +1,16 @@ +--- +- datatypes: + - meg + - eeg + - ieeg + suffixes: + - events + extensions: + - .json + - .tsv + entities: + sub: required + ses: optional + task: required + acq: optional + run: optional diff --git a/bids-validator/schemas/auxdatatypes/photo.yaml b/bids-validator/schemas/auxdatatypes/photo.yaml new file mode 100644 index 000000000..e104d04aa --- /dev/null +++ b/bids-validator/schemas/auxdatatypes/photo.yaml @@ -0,0 +1,13 @@ +--- +- datatypes: + - meg + - eeg + - ieeg + suffixes: + - photo + extensions: + - .jpg + entities: + sub: required + ses: optional + acq: optional diff --git a/bids-validator/schemas/datatypes/anat.yaml b/bids-validator/schemas/datatypes/anat.yaml new file mode 100644 index 000000000..764f26cb2 --- /dev/null +++ b/bids-validator/schemas/datatypes/anat.yaml @@ -0,0 +1,173 @@ +--- +# First group +- suffixes: + - T1w + - T2w + - PDw + - T2starw + - FLAIR + - inplaneT1 + - inplaneT2 + - PDT2 + - angio + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + part: optional +# Second group +- suffixes: + - T1map + - T2map + - T2starmap + - R1map + - R2map + - R2starmap + - PDmap + - MTRmap + - MTsat + - UNIT1 + - T1rho + - MWFmap + - MTVmap + - PDT2map + - Chimap + - TB1map + - RB1map + - S0map + - M0map + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional +# Third group +- suffixes: + - defacemask + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + modality: optional +# Fourth group +- suffixes: + - MESE + - MEGRE + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + echo: required + part: optional +# Fifth group +- suffixes: + - VFA + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + flip: required + part: optional +# Sixth group +- suffixes: + - IRT1 + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + inversion: required + part: optional +# Seventh group +- suffixes: + - MP2RAGE + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + echo: optional + flip: required + inversion: required + part: optional +# Eighth group +- suffixes: + - MPM + - MTS + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + echo: optional + flip: required + mtransfer: required + part: optional +# Nineth group +- suffixes: + - MTR + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + mtransfer: required + part: optional diff --git a/bids-validator/schemas/datatypes/beh.yaml b/bids-validator/schemas/datatypes/beh.yaml new file mode 100644 index 000000000..d9de3cd0d --- /dev/null +++ b/bids-validator/schemas/datatypes/beh.yaml @@ -0,0 +1,28 @@ +--- +# First group +- suffixes: + - stim + - physio + extensions: + - .tsv.gz + - .json + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional + recording: optional +# Second group +- suffixes: + - events + - beh + extensions: + - .tsv + - .json + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional diff --git a/bids-validator/schemas/datatypes/dwi.yaml b/bids-validator/schemas/datatypes/dwi.yaml new file mode 100644 index 000000000..8d0fbb931 --- /dev/null +++ b/bids-validator/schemas/datatypes/dwi.yaml @@ -0,0 +1,31 @@ +--- +# First group +- suffixes: + - dwi + extensions: + - .nii.gz + - .nii + - .json + - .bvec + - .bval + entities: + subject: required + session: optional + acquisition: optional + direction: optional + run: optional + part: optional +# Second group +- suffixes: + - sbref + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + acquisition: optional + direction: optional + run: optional + part: optional diff --git a/bids-validator/schemas/datatypes/eeg.yaml b/bids-validator/schemas/datatypes/eeg.yaml new file mode 100644 index 000000000..60178177d --- /dev/null +++ b/bids-validator/schemas/datatypes/eeg.yaml @@ -0,0 +1,66 @@ +--- +- suffixes: + - eeg + extensions: + - .json + - .edf + - .vhdr + - .vmrk + - .eeg + - .set + - .fdt + - .bdf + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional +- suffixes: + - channels + extensions: + - .json + - .tsv + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional +- suffixes: + - coordsystem + extensions: + - .json + entities: + subject: required + session: optional + acquisition: optional +- suffixes: + - electrodes + extensions: + - .json + - .tsv + entities: + subject: required + session: optional + acquisition: optional + space: optional +- suffixes: + - events + extensions: + - .json + - .tsv + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional +- suffixes: + - photo + extensions: + - .jpg + entities: + subject: required + session: optional + acquisition: optional diff --git a/bids-validator/schemas/datatypes/fmap.yaml b/bids-validator/schemas/datatypes/fmap.yaml new file mode 100644 index 000000000..1eb84f7e5 --- /dev/null +++ b/bids-validator/schemas/datatypes/fmap.yaml @@ -0,0 +1,67 @@ +--- +# First group +- suffixes: + - phasediff + - phase1 + - phase2 + - magnitude1 + - magnitude2 + - magnitude + - fieldmap + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + acquisition: optional + run: optional +# Second group +- suffixes: + - epi + - m0scan + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + acquisition: optional + ceagent: optional + direction: required + run: optional +# Third group +- suffixes: + - TB1DAM + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + flip: required + part: optional +# Fourth group +- suffixes: + - TB1EPI + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + run: optional + acquisition: optional + ceagent: optional + reconstruction: optional + echo: required + flip: required + part: optional diff --git a/bids-validator/schemas/datatypes/func.yaml b/bids-validator/schemas/datatypes/func.yaml new file mode 100644 index 000000000..653b86d08 --- /dev/null +++ b/bids-validator/schemas/datatypes/func.yaml @@ -0,0 +1,69 @@ +--- +# First group +- suffixes: + - bold + - cbv + - sbref + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + task: required + acquisition: optional + ceagent: optional + reconstruction: optional + direction: optional + run: optional + echo: optional + part: optional +# Second group +- suffixes: + - phase + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + task: required + acquisition: optional + ceagent: optional + reconstruction: optional + direction: optional + run: optional + echo: optional +# Third group +- suffixes: + - events + extensions: + - .tsv + - .json + entities: + subject: required + session: optional + task: required + acquisition: optional + ceagent: optional + reconstruction: optional + direction: optional + run: optional + echo: optional +# Fourth group +- suffixes: + - physio + - stim + extensions: + - .tsv.gz + - .json + entities: + subject: required + session: optional + task: required + acquisition: optional + reconstruction: optional + run: optional + recording: optional diff --git a/bids-validator/schemas/datatypes/ieeg.yaml b/bids-validator/schemas/datatypes/ieeg.yaml new file mode 100644 index 000000000..50c060e35 --- /dev/null +++ b/bids-validator/schemas/datatypes/ieeg.yaml @@ -0,0 +1,67 @@ +--- +- suffixes: + - ieeg + extensions: + - .mefd/ + - .json + - .edf + - .vhdr + - .eeg + - .vmrk + - .set + - .fdt + - .nwb + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional +- suffixes: + - channels + extensions: + - .json + - .tsv + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional +- suffixes: + - coordsystem + extensions: + - .json + entities: + subject: required + session: optional + space: optional +- suffixes: + - electrodes + extensions: + # No json, since electrodes.tsv uses coordsystem.json for metadata + - .tsv + entities: + subject: required + session: optional + space: optional + acquisition: optional +- suffixes: + - events + extensions: + - .json + - .tsv + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional +- suffixes: + - photo + extensions: + - .jpg + entities: + subject: required + session: optional + acquisition: optional diff --git a/bids-validator/schemas/datatypes/meg.yaml b/bids-validator/schemas/datatypes/meg.yaml new file mode 100644 index 000000000..b2c1e3e8e --- /dev/null +++ b/bids-validator/schemas/datatypes/meg.yaml @@ -0,0 +1,85 @@ +--- +# First group +- suffixes: + - meg + extensions: + - / # corresponds to BTi/4D data + - .ds/ + - .json + - .fif + - .sqd + - .con + - .raw + - .ave + - .mrk + - .kdf + - .mhd + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional + processing: optional + split: optional +# Second group +- suffixes: + - headshape + extensions: + - "*" + entities: + subject: required + session: optional + acquisition: optional +# Third group +- suffixes: + - markers + extensions: + - .sqd + - .mrk + entities: + subject: required + session: optional + task: optional + acquisition: optional + space: optional +# Fourth +- suffixes: + - coordsystem + extensions: + - .json + entities: + subject: required + session: optional + acquisition: optional +- suffixes: + - channels + extensions: + - .json + - .tsv + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional + processing: optional +- suffixes: + - events + extensions: + - .json + - .tsv + entities: + subject: required + session: optional + task: required + acquisition: optional + run: optional +- suffixes: + - photo + extensions: + - .jpg + entities: + subject: required + session: optional + acquisition: optional diff --git a/bids-validator/schemas/datatypes/perf.yaml b/bids-validator/schemas/datatypes/perf.yaml new file mode 100644 index 000000000..be6542071 --- /dev/null +++ b/bids-validator/schemas/datatypes/perf.yaml @@ -0,0 +1,40 @@ +--- +# First group +- suffixes: + - asl + - m0scan + extensions: + - .nii.gz + - .nii + - .json + entities: + subject: required + session: optional + acquisition: optional + reconstruction: optional + direction: optional + run: optional +# Second group +- suffixes: + - aslcontext + extensions: + - .tsv + - .json + entities: + subject: required + session: optional + acquisition: optional + reconstruction: optional + direction: optional + run: optional +# Third group +- suffixes: + - asllabeling + extensions: + - .jpg + entities: + subject: required + session: optional + acquisition: optional + reconstruction: optional + run: optional diff --git a/bids-validator/schemas/entities.yaml b/bids-validator/schemas/entities.yaml new file mode 100644 index 000000000..566cf53fd --- /dev/null +++ b/bids-validator/schemas/entities.yaml @@ -0,0 +1,254 @@ +--- +subject: + name: Subject + entity: sub + description: | + A person or animal participating in the study. + format: label +session: + name: Session + entity: ses + description: | + A logical grouping of neuroimaging and behavioral data consistent across + subjects. + Session can (but doesn't have to) be synonymous to a visit in a + longitudinal study. + In general, subjects will stay in the scanner during one session. + However, for example, if a subject has to leave the scanner room and then + be re-positioned on the scanner bed, the set of MRI acquisitions will still + be considered as a session and match sessions acquired in other subjects. + Similarly, in situations where different data types are obtained over + several visits (for example fMRI on one day followed by DWI the day after) + those can be grouped in one session. + Defining multiple sessions is appropriate when several identical or similar + data acquisitions are planned and performed on all -or most- subjects, + often in the case of some intervention between sessions + (for example, training). + format: label +task: + name: Task + entity: task + format: label + description: | + Each task has a unique label that MUST only consist of letters and/or + numbers (other characters, including spaces and underscores, are not + allowed). + Those labels MUST be consistent across subjects and sessions. +acquisition: + name: Acquisition + entity: acq + description: | + The `acq-