Skip to content

Commit

Permalink
overhaul accepted coordinate keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff committed Jan 15, 2021
1 parent e367101 commit 5709bea
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 11 deletions.
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
49 changes: 49 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,55 @@
"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",
"Pixels",
"ACPC",
"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": { "$ref": "common_definitions.json#/definitions/CoordUnits" },
"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

0 comments on commit 5709bea

Please sign in to comment.