From 5709bea55d32d61297d54c7c8ac319e06842844a Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Fri, 15 Jan 2021 13:54:14 +0100 Subject: [PATCH] overhaul accepted coordinate keywords --- bids-validator/tests/json.spec.js | 8 ++- .../json/schemas/common_definitions.json | 49 +++++++++++++++++++ .../json/schemas/coordsystem_eeg.json | 21 ++++++-- .../json/schemas/coordsystem_ieeg.json | 6 ++- .../json/schemas/coordsystem_meg.json | 35 +++++++++++-- 5 files changed, 108 insertions(+), 11 deletions(-) diff --git a/bids-validator/tests/json.spec.js b/bids-validator/tests/json.spec.js index fa60abe69..a62c4803e 100644 --- a/bids-validator/tests/json.spec.js +++ b/bids-validator/tests/json.spec.js @@ -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: { @@ -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', + ) }) }) diff --git a/bids-validator/validators/json/schemas/common_definitions.json b/bids-validator/validators/json/schemas/common_definitions.json index 5d15a0010..eca0bf0ff 100644 --- a/bids-validator/validators/json/schemas/common_definitions.json +++ b/bids-validator/validators/json/schemas/common_definitions.json @@ -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 }, diff --git a/bids-validator/validators/json/schemas/coordsystem_eeg.json b/bids-validator/validators/json/schemas/coordsystem_eeg.json index 294cf41d4..c1b6fae87 100644 --- a/bids-validator/validators/json/schemas/coordsystem_eeg.json +++ b/bids-validator/validators/json/schemas/coordsystem_eeg.json @@ -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 } }, diff --git a/bids-validator/validators/json/schemas/coordsystem_ieeg.json b/bids-validator/validators/json/schemas/coordsystem_ieeg.json index 80fdc7146..90a11feb1 100644 --- a/bids-validator/validators/json/schemas/coordsystem_ieeg.json +++ b/bids-validator/validators/json/schemas/coordsystem_ieeg.json @@ -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 }, diff --git a/bids-validator/validators/json/schemas/coordsystem_meg.json b/bids-validator/validators/json/schemas/coordsystem_meg.json index abe2fd1c5..f0a5cff17 100644 --- a/bids-validator/validators/json/schemas/coordsystem_meg.json +++ b/bids-validator/validators/json/schemas/coordsystem_meg.json @@ -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": { @@ -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 } },