Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON-schema: overhaul accepted coordinate keywords #1149

Merged
merged 3 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bids-validator/tests/data/bids-examples
Submodule bids-examples updated 2829 files
8 changes: 6 additions & 2 deletions bids-validator/tests/json.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('JSON', function() {
MEGCoordinateSystem: 'CTF',
MEGCoordinateUnits: 'mm',
MEGCoordinateSystemDescription: 'this is the usual ...',
EEGCoordinateSystem: 'Other',
EEGCoordinateSystem: 'CapTrak',
EEGCoordinateSystemDescription: 'RAS orientation ...',
HeadCoilCoordinateSystem: 'Other',
HeadCoilCoordinates: {
Expand Down Expand Up @@ -223,11 +223,15 @@ describe('JSON', function() {
}
jsonDict[eeg_coordsystem_file.relativePath] = jsonObj
validate.JSON(eeg_coordsystem_file, jsonDict, function(issues) {
assert(issues.length === 1)
assert(issues.length === 5)
assert(
issues[0].evidence ==
'.EEGCoordinateSystem should be equal to one of the allowed values',
)
assert(
issues[4].evidence ==
'.EEGCoordinateSystem should match some schema in anyOf',
)
})
})

Expand Down
47 changes: 47 additions & 0 deletions bids-validator/validators/json/schemas/common_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,53 @@
"CogAtlasID": { "type": "string", "format": "uri" },
"CogPOID": { "type": "string", "format": "uri" },
"CoordUnits": { "type": "string", "enum": ["m", "mm", "cm", "n/a"] },
"MEGCoordSys": { "type": "string", "enum": ["CTF", "ElektaNeuromag", "4DBti", "KitYokogawa", "ChietiItab", "Other"] },
"EEGCoordSys": { "type": "string", "enum": ["CapTrak", "Other"] },
"iEEGCoordSys": { "type": "string", "enum": ["Pixels", "ACPC", "Other"] },
"StandardTemplateCoordSys" :{
"type": "string",
"enum": [
"ICBM452AirSpace",
"ICBM452Warp5Space",
"IXI549Space",
"fsaverage",
"fsaverageSym",
"fsLR",
"MNIColin27",
"MNI152Lin",
"MNI152NLin2009aSym",
"MNI152NLin2009bSym",
"MNI152NLin2009cSym",
"MNI152NLin2009aAsym",
"MNI152NLin2009bAsym",
"MNI152NLin2009cAsym",
"MNI152NLin6Sym",
"MNI152NLin6ASym",
"MNI305",
"NIHPD",
"OASIS30AntsOASISAnts",
"OASIS30Atropos",
"Talairach",
"UNCInfant"
] },
"StandardTemplateDeprecatedCoordSys" :{
"type": "string",
"enum": [
"fsaverage3",
"fsaverage4",
"fsaverage5",
"fsaverage6",
"fsaveragesym",
"UNCInfant0V21",
"UNCInfant1V21",
"UNCInfant2V21",
"UNCInfant0V22",
"UNCInfant1V22",
"UNCInfant2V22",
"UNCInfant0V23",
"UNCInfant1V23",
"UNCInfant2V23"
] },
"DeviceSerialNumber": { "type": "string" },
"ECGChannelCount": { "type": "integer", "minimum": 0 },
"EEGChannelCount": { "type": "integer", "minimum": 0 },
Expand Down
21 changes: 18 additions & 3 deletions bids-validator/validators/json/schemas/coordsystem_eeg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,29 @@
"IntendedFor": { "type": "string", "minLength": 1 },
"FiducialsDescription": { "type": "string", "minLength": 1 },
"FiducialsCoordinates": { "$ref": "common_definitions.json#/definitions/LandmarkCoordinates" },
"FiducialsCoordinateSystem": { "type": "string", "enum": ["CapTrak", "Other"] },
"FiducialsCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/MEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/EEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"FiducialsCoordinateSystemDescription": { "type": "string", "minLength": 1 },
"FiducialsCoordinateUnits": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"EEGCoordinateSystem": { "type": "string", "enum": ["CapTrak", "Other"] },
"EEGCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/MEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/EEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"EEGCoordinateUnits": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"EEGCoordinateSystemDescription": { "type": "string", "minLength": 1 },
"AnatomicalLandmarkCoordinates": { "$ref": "common_definitions.json#/definitions/LandmarkCoordinates" },
"AnatomicalLandmarkCoordinateSystem": { "type": "string", "enum": ["CapTrak", "Other"] },
"AnatomicalLandmarkCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/MEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/EEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"AnatomicalLandmarkCoordinateUnits": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"AnatomicalLandmarkCoordinateSystemDescription": { "type": "string", "minLength": 1 }
},
Expand Down
6 changes: 5 additions & 1 deletion bids-validator/validators/json/schemas/coordsystem_ieeg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"type": "object",
"properties": {
"IntendedFor": { "type": "string", "minLength": 1 },
"iEEGCoordinateSystem": { "type": "string", "enum": ["Pixels", "ACPC", "Other"] },
"iEEGCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/iEEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"iEEGCoordinateUnits": { "type": "string", "enum": ["m", "mm", "cm", "pixels", "n/a"] },
"iEEGCoordinateSystemDescription": { "type": "string", "minLength": 1 },
"iEEGCoordinateProcessingDescription": { "type": "string", "minLength": 1 },
Expand Down
35 changes: 30 additions & 5 deletions bids-validator/validators/json/schemas/coordsystem_meg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{
"type": "object",
"properties": {
"MEGCoordinateSystem": { "type": "string", "enum": ["CTF", "ElektaNeuromag", "4DBti", "KitYokogawa", "ChietiItab", "Other"] },
"MEGCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/MEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/EEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"MEGCoordinateUnits": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"MEGCoordinateSystemDescription": { "type": "string", "minLength": 1 },
"EEGCoordinateSystem": { "type": "string", "enum": ["CTF", "ElektaNeuromag", "4DBti", "KitYokogawa", "ChietiItab", "Other"] },
"EEGCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/MEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/EEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"EEGCoordinateUnits": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"EEGCoordinateSystemDescription": { "type": "string", "minLength": 1 },
"IntendedFor": {
Expand All @@ -21,15 +31,30 @@
},
"FiducialsDescription": { "type": "string", "minLength": 1 },
"HeadCoilCoordinates": { "$ref": "common_definitions.json#/definitions/LandmarkCoordinates" },
"HeadCoilCoordinateSystem": { "type": "string", "enum": ["CTF", "ElektaNeuromag", "4DBti", "KitYokogawa", "ChietiItab", "Other"] },
"HeadCoilCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/MEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/EEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"HeadCoilCoordinateUnits": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"HeadCoilCoordinateSystemDescription": { "type": "string", "minLength": 1 },
"AnatomicalLandmarkCoordinates": { "$ref": "common_definitions.json#/definitions/LandmarkCoordinates" },
"AnatomicalLandmarkCoordinateSystem": { "type": "string", "enum": ["CTF", "ElektaNeuromag", "4DBti", "KitYokogawa", "ChietiItab", "Other"] },
"AnatomicalLandmarkCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/MEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/EEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"AnatomicalLandmarkCoordinateUnits": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"AnatomicalLandmarkCoordinateSystemDescription": { "type": "string", "minLength": 1 },
"DigitizedHeadPoints": { "type": "string" },
"DigitizedHeadPointsCoordinateSystem": { "type": "string", "enum": ["CTF", "ElektaNeuromag", "4DBti", "KitYokogawa", "ChietiItab", "Other"] },
"DigitizedHeadPointsCoordinateSystem": { "anyOf": [
{ "$ref": "common_definitions.json#/definitions/MEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/EEGCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateCoordSys" },
{ "$ref": "common_definitions.json#/definitions/StandardTemplateDeprecatedCoordSys" }
]},
"DigitizedHeadPointsCoordinateUnits": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"DigitizedHeadPointsCoordinateSystemDescription": { "type": "string", "minLength": 1 }
},
Expand Down