Skip to content

Commit

Permalink
Validation of PET data
Browse files Browse the repository at this point in the history
  • Loading branch information
EDRasmussen committed May 16, 2020
1 parent 02b37a7 commit 845970c
Show file tree
Hide file tree
Showing 10 changed files with 458 additions and 9 deletions.
37 changes: 36 additions & 1 deletion bids-validator/bids_validator/rules/file_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,14 @@
"meg": {
"regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)?meg\\/\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_part-[0-9]+)?(_digitizer.txt|_meg(@@@_meg_type_@@@\\/(.(?!\\.(sqd|con|fif|raw|raw\\.mhd|trg|kdf|chn)$))*|\\/(.(?!\\.(sqd|con|fif|raw|raw\\.mhd|trg|kdf|chn)$))*)|(@@@_meg_ext_@@@))$",
"tokens": {
"@@@_meg_type_@@@": ["\\.ds/.*", "\\.(?:chn|kdf|trg)", "\\.(?:raw|raw\\.mhd)", "\\.fif", "\\.(?:con|sqd)", "\\.(?:kdf|chn|trg)"],
"@@@_meg_type_@@@": [
"\\.ds/.*",
"\\.(?:chn|kdf|trg)",
"\\.(?:raw|raw\\.mhd)",
"\\.fif",
"\\.(?:con|sqd)",
"\\.(?:kdf|chn|trg)"
],
"@@@_meg_ext_@@@": [
"_events\\.json",
"_events\\.tsv",
Expand All @@ -219,6 +226,34 @@
}
},

"pet": {
"regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)pet\\/(sub-[a-zA-Z0-9]+)_(?:(ses-[a-zA-Z0-9]+))|((@@@_pet_ext_@@@))$",
"tokens": {
"@@@_pet_ext_@@@": ["_pet.json", "_pet\\.nii\\.gz", "_pet\\.nii"]
}
},

"pet_blood": {
"regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)pet\\/(sub-[a-zA-Z0-9]+)_(?:(ses-[a-zA-Z0-9]+))|((@@@_pet_ext_@@@))$",
"tokens": {
"@@@_pet_ext_@@@": ["_pet-blood\\.nii\\.json"]
}
},

"pet_data": {
"regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)pet\\/(sub-[a-zA-Z0-9]+)_(?:(ses-[a-zA-Z0-9]+))|((@@@_pet_ext_@@@))$",
"tokens": {
"@@@_pet_ext_@@@": ["_pet\\.nii\\.gz", "_pet\\.nii"]
}
},

"pet_blood_data": {
"regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)pet\\/(sub-[a-zA-Z0-9]+)_(?:(ses-[a-zA-Z0-9]+))|((@@@_pet_ext_@@@))$",
"tokens": {
"@@@_pet_ext_@@@": ["_pet-blood\\.tsv"]
}
},

"stimuli": {
"regexp": "^\\/(?:stimuli)\\/(?:.*)$"
}
Expand Down
1 change: 1 addition & 0 deletions bids-validator/bids_validator/tsv/non_custom_columns.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"sample",
"value"
],
"pet-blood": ["Time", "PlasmaActivity"],
"misc": [],
"participants": ["participant_id", "age", "sex"],
"phenotype": ["participant_id"],
Expand Down
9 changes: 7 additions & 2 deletions bids-validator/utils/issues/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,17 @@ export default {
key: 'INVALID_TSV_UNITS',
severity: 'error',
reason:
'Units in .tsv files must be valid SI units as described in the BIDS spec Appendix V (https://bids-specification.readthedocs.io/en/stable/99-appendices/05-units.html).'
'Units in .tsv files must be valid SI units as described in the BIDS spec Appendix V (https://bids-specification.readthedocs.io/en/stable/99-appendices/05-units.html).',
},
125: {
key: 'CHANNELS_COLUMN_STATUS',
severity: 'error',
reason:
'Status column in channels.tsv files must contain only one of two values: good or bad. Per the BIDS spec: (https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/04-intracranial-electroencephalography.html#channels-description-_channelstsv).'
'Status column in channels.tsv files must contain only one of two values: good or bad. Per the BIDS spec: (https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/04-intracranial-electroencephalography.html#channels-description-_channelstsv).',
},
126: {
key: 'CHANNELS_COLUMN_STATUS',
severity: 'error',
reason: 'This is a test error for PET scan blood data!',
},
}
2 changes: 1 addition & 1 deletion bids-validator/utils/modalities.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
// MRI
if (
path[0].includes('.nii') &&
['anat', 'func', 'dwi'].indexOf(path[1]) != -1
['anat', 'func', 'dwi', 'pet'].indexOf(path[1]) != -1
) {
isCorrectModality = true
} else if (['.json', '.tsv'].some(v => path[0].includes(v))) {
Expand Down
28 changes: 26 additions & 2 deletions bids-validator/utils/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const anatData = buildRegExp(file_level_rules.anat)
const anatDefacemaskData = buildRegExp(file_level_rules.anat_defacemask)
const behavioralData = buildRegExp(file_level_rules.behavioral)
const contData = buildRegExp(file_level_rules.cont)
const petDataFile = buildRegExp(file_level_rules.pet_data)
const petBloodDataFile = buildRegExp(file_level_rules.pet_blood_data)
const dwiData = buildRegExp(file_level_rules.dwi)
const eegData = buildRegExp(file_level_rules.eeg)
const fieldmapData = buildRegExp(file_level_rules.field_map)
Expand All @@ -34,6 +36,8 @@ const funcBoldData = buildRegExp(file_level_rules.func_bold)
const ieegData = buildRegExp(file_level_rules.ieeg)
const megData = buildRegExp(file_level_rules.meg)
const stimuliData = buildRegExp(file_level_rules.stimuli)
const petData = buildRegExp(file_level_rules.pet)
const petBloodData = buildRegExp(file_level_rules.pet_blood)
// Phenotypic data
const phenotypicData = buildRegExp(phenotypic_rules.phenotypic_data)
// Session level
Expand Down Expand Up @@ -79,7 +83,9 @@ export default {
this.file.isBehavioral(path) ||
this.file.isCont(path) ||
this.file.isFieldMap(path) ||
this.file.isPhenotypic(path)
this.file.isPhenotypic(path) ||
this.file.isPET(path) ||
this.file.isPETBlood(path)
)
},

Expand Down Expand Up @@ -206,6 +212,14 @@ export default {
return conditionalMatch(ieegData, path)
},

isPET: function(path) {
return conditionalMatch(petData, path)
},

isPETBlood: function(path) {
return conditionalMatch(petBloodData, path)
},

isBehavioral: function(path) {
return conditionalMatch(behavioralData, path)
},
Expand All @@ -218,6 +232,14 @@ export default {
return conditionalMatch(contData, path)
},

isPETData: function(path) {
return conditionalMatch(petDataFile, path)
},

isPETBloodData: function(path) {
return conditionalMatch(petBloodDataFile, path)
},

hasModality: function(path) {
return (
this.isAnat(path) ||
Expand All @@ -230,7 +252,9 @@ export default {
this.isIEEG(path) ||
this.isBehavioral(path) ||
this.isFuncBold(path) ||
this.isCont(path)
this.isCont(path) ||
this.isPETData(path) ||
this.isPETBloodData(path)
)
},
},
Expand Down
4 changes: 4 additions & 0 deletions bids-validator/validators/json/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ const selectSchema = file => {
file.name.endsWith('coordsystem.json')
) {
schema = require('./schemas/coordsystem_eeg.json')
} else if (file.name.endsWith('pet_blood.json')) {
schema = require('./schemas/pet_blood.json')
} else if (file.name.endsWith('pet.json')) {
schema = require('./schemas/pet.json')
}
}
return schema
Expand Down
205 changes: 205 additions & 0 deletions bids-validator/validators/json/schemas/pet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
{
"type": "object",
"properties": {
"Modality": { "type": "string", "minLength": 1 },
"Manufacturer": { "type": "string", "minLength": 1 },
"ManufacturersModelName": { "type": "string", "minLength": 1 },
"Anaesthesia": { "type": "string", "minLength": 1 },
"BodyPart": { "type": "string", "minLength": 1 },
"BodyWeight": { "type": "number" },
"BodyWeightUnit": { "type": "string", "minLength": 1 },
"Unit": {
"type": "string",
"minLength": 1,
"enum": ["becquerel per milliliter"]
},
"TracerName": { "type": "string", "minLength": 1 },
"TracerRadLex": { "type": "string", "minLength": 1 },
"TracerSNOMED": { "type": "string", "minLength": 1 },
"TracerRadionuclide": { "type": "string", "minLength": 1 },
"TracerMolecularWeight": { "type": "number" },
"TracerMolecularWeightUnit": { "type": "string", "minLength": 1 },
"PharmaceuticalName": { "type": "string", "minLength": 1 },
"PharmaceuticalDoseAmount": { "type": "string", "minLength": 1 },
"PharmaceuticalDoseUnits": { "type": "string", "minLength": 1 },
"PharmaceuticalDoseRegimen": { "type": "string", "minLength": 1 },
"PharmaceuticalDoseTime": { "type": "number" },
"PharmaceuticalDoseTimeUnits": { "type": "string", "minLength": 1 },

"InjectedRadioactivity": { "type": "number" },
"InjectedRadioActivityUnit": {
"type": "string",
"minLength": 1,
"enum": ["megabecquerel"]
},
"InjectedMass": { "type": "number" },
"InjectedMassUnits": {
"type": "string",
"minLength": 1,
"enum": ["micrograms", "milligrams", "grams"]
},
"SpecificRadioactivity": { "type": "number" },
"SpecificRadioactivityUnit": {
"type": "string",
"minLength": 1,
"enum": ["becquerel per grams", "gigabecquerel per micrograms"]
},
"SpecificRadioactivityMeasTime": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"MolarActivity": { "type": "number" },
"MolarActivityUnit": {
"type": "string",
"minLength": 1,
"enum": ["becquerel per molar", "gigabecquerel per micromolar"]
},
"MolarActivityMeasTime": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"ModeOfAdministration": { "type": "string", "minLength": 1 },
"InfusionSpeed": { "type": "string", "minLength": 1 },
"InfusionSpeedUnit": { "type": "string", "minLength": 1 },
"InjectedVolume": { "type": "number" },
"InjectedVolumeUnit": { "type": "string", "minLength": 1 },
"Purity": { "type": "number" },
"PurityUnits": { "type": "string", "minLength": 1 },

"ScanDate": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"ScanStart": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"InjectionStart": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"InjectionEnd": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"TimeZero": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"FrameTimesStart": {
"type": "array",
"items": { "type": "number" }
},
"FrameTimesStartUnits": { "type": "string", "minLength": 1 },
"FrameTimesEnd": {
"type": "array",
"items": { "type": "number" }
},
"FrameTimesEndUnits": { "type": "string", "minLength": 1 },

"AcquisitionMode": { "type": "string", "minLength": 1 },
"ImageDecayCorrected": { "type": "boolean" },
"ImageDecayCorrectionTime": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"DiameterFOV": {
"type": "array",
"items": { "type": "number" }
},
"DiameterFOVUnit": { "type": "string", "minLength": 1 },
"ImageOrientation": {
"type": "array",
"items": { "type": "string" }
},
"ReconMatrixSize": {
"type": "array",
"items": { "type": "number" }
},
"ImageVoxelSize": {
"type": "array",
"items": { "type": "number" }
},
"ReconMethodName": { "type": "string", "minLength": 1 },
"ReconMethodParameterLabels": {
"type": "array",
"items": { "type": "string" }
},
"ReconMethodParameterUnit": {
"type": "array",
"items": { "type": "string" }
},
"ReconMethodParameterValues": {
"type": "array",
"items": { "type": "number" }
},
"ReconMethodImplementationVersion": { "type": "string", "minLength": 1 },
"ReconFilterType": {
"type": "array",
"items": { "type": "string" }
},
"ReconFilterSize": {
"type": "array",
"items": { "type": "number" }
},
"AttenuationCorrection": { "type": "string", "minLength": 1 },
"AttenuationCorrectionMethodReference": { "type": "string", "minLength": 1 }
},
"required": [
"Modality",
"Manufacturer",
"ManufacturersModelName",
"Unit",
"TracerName",
"TracerRadionuclide",

"InjectedRadioactivity",
"InjectedRadioactivityUnit",
"InjectedMass",
"InjectedMassUnits",
"SpecificRadioactivity",
"SpecificRadioactivityUnit",
"ModeOfAdministration",

"ScanStart",
"InjectionStart",
"TimeZero",
"FrameTimesStart",
"FrameTimesStartUnits",
"FrameTimesEnd",
"FrameTimesEndUnits",
"AcquisitionMode",
"ImageDecayCorrected",
"ImageDecayCorrectionTime",
"ReconMatrixSize",
"ImageVoxelSize",
"ReconMethodName",
"ReconMethodParameterLabels",
"ReconMethodParameterUnit",
"ReconMethodParameterValues",
"ReconFilterType",
"ReconFilterSize",
"AttenuationCorrection"
],
"dependencies": {
"TracerMolecularWeight": ["TracerMolecularWeightUnit"],
"BodyWeight": ["BodyWeightUnit"],

"InjectedRadioactivity": ["InjectedRadioActivityUnit"],
"InjectedMass": ["InjectedMassUnits"],
"MolarActivity": ["MolarActivityUnit"],
"SpecificRadioactivity": ["SpecificRadioactivityUnit"],
"Purity": ["PurityUnits"],
"InfusionSpeed": ["InfusionSpeedUnit"],
"InjectedVolume": ["InjectedVolumeUnit"],

"FrameTimesStart": ["FrameTimesStartUnits"],
"FrameTimesEnd": ["FrameTimesEndUnits"],

"DiameterFOV": ["DiameterFOVUnit"],
"ReconMethodParameterLabels": [
"ReconMethodParameterUnit",
"ReconMethodParameterValues"
]
}
}
Loading

0 comments on commit 845970c

Please sign in to comment.