diff --git a/bids-validator/bids_validator/rules/file_level_rules.json b/bids-validator/bids_validator/rules/file_level_rules.json index 4438f32d5..28a90fe05 100644 --- a/bids-validator/bids_validator/rules/file_level_rules.json +++ b/bids-validator/bids_validator/rules/file_level_rules.json @@ -221,5 +221,23 @@ "stimuli": { "regexp": "^\\/(?:stimuli)\\/(?:.*)$" + }, + + "nirs": { + "regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)?nirs\\/\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_part-[0-9]+)?(_nirs\\.(@@@_nirs_type_@@@)|(@@@_nirs_ext_@@@))$", + "tokens": { + "@@@_nirs_type_@@@": ["snirf"], + "@@@_nirs_ext_@@@": [ + "_events\\.json", + "_events\\.tsv", + "_optodes\\.json", + "_optodes\\.tsv", + "_channels\\.json", + "_channels\\.tsv", + "_nirs\\.json", + "_coordsystem\\.json", + "_photo\\.jpg" + ] + } } } diff --git a/bids-validator/bids_validator/rules/session_level_rules.json b/bids-validator/bids_validator/rules/session_level_rules.json index 6f64afffc..44e54b3ee 100644 --- a/bids-validator/bids_validator/rules/session_level_rules.json +++ b/bids-validator/bids_validator/rules/session_level_rules.json @@ -88,5 +88,19 @@ "_photo.jpg" ] } + }, + + "nirs_ses": { + "regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)?\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(@@@_nirs_ses_type_@@@)$", + "tokens": { + "@@@_nirs_ses_type_@@@": [ + "_events.tsv", + "_channels.tsv", + "_optodes.tsv", + "_nirs.json", + "_coordsystem.json", + "_photo.jpg" + ] + } } } diff --git a/bids-validator/bids_validator/rules/top_level_rules.json b/bids-validator/bids_validator/rules/top_level_rules.json index 79d23b803..51622ca37 100644 --- a/bids-validator/bids_validator/rules/top_level_rules.json +++ b/bids-validator/bids_validator/rules/top_level_rules.json @@ -79,6 +79,18 @@ ] } }, + "nirs_top": { + "regexp": "^\\/(?:ses-[a-zA-Z0-9]+_)?task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:@@@_nirs_top_ext_@@@)$", + "tokens": { + "@@@_nirs_top_ext_@@@": [ + "_nirs\\.json", + "_channels\\.tsv", + "_optodes\\.tsv", + "_photo\\.jpg", + "_coordsystem\\.json" + ] + } + }, "multi_dir_fieldmap": { "regexp": "^\\/(?:acq-[a-zA-Z0-9]+_)?(?:dir-[a-zA-Z0-9]+_)epi\\.json$" }, diff --git a/bids-validator/utils/modalities.js b/bids-validator/utils/modalities.js index b2a0f91fb..690e4338a 100644 --- a/bids-validator/utils/modalities.js +++ b/bids-validator/utils/modalities.js @@ -60,7 +60,11 @@ export default { isCorrectModality = true break case 'ieeg': - // iEEG + // EEG + isCorrectModality = true + break + case 'nirs': + // NIRS isCorrectModality = true break default: diff --git a/bids-validator/utils/type.js b/bids-validator/utils/type.js index ddd20dc2f..fdeca6719 100644 --- a/bids-validator/utils/type.js +++ b/bids-validator/utils/type.js @@ -34,6 +34,7 @@ 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 nirsData = buildRegExp(file_level_rules.nirs) // Phenotypic data const phenotypicData = buildRegExp(phenotypic_rules.phenotypic_data) // Session level @@ -44,6 +45,7 @@ const funcSes = buildRegExp(session_level_rules.func_ses) const ieegSes = buildRegExp(session_level_rules.ieeg_ses) const megSes = buildRegExp(session_level_rules.meg_ses) const scansSes = buildRegExp(session_level_rules.scans) +const nirsSes = buildRegExp(session_level_rules.nirs_ses) // Subject level const subjectLevel = buildRegExp(subject_level_rules.subject_level) // Top level @@ -56,6 +58,7 @@ const ieegTop = buildRegExp(top_level_rules.ieeg_top) const multiDirFieldmap = buildRegExp(top_level_rules.multi_dir_fieldmap) const otherTopFiles = buildRegExp(top_level_rules.other_top_files) const megTop = buildRegExp(top_level_rules.meg_top) +const nirsTop = buildRegExp(top_level_rules.nirs_top) export default { /** @@ -74,6 +77,7 @@ export default { this.file.isDWI(path) || this.file.isFunc(path) || this.file.isMeg(path) || + this.file.isNIRS(path) || this.file.isIEEG(path) || this.file.isEEG(path) || this.file.isBehavioral(path) || @@ -99,6 +103,7 @@ export default { multiDirFieldmap.test(path) || otherTopFiles.test(path) || megTop.test(path) || + nirsTop.test(path) || eegTop.test(path) || ieegTop.test(path) ) @@ -147,6 +152,7 @@ export default { conditionalMatch(anatSes, path) || conditionalMatch(dwiSes, path) || conditionalMatch(megSes, path) || + conditionalMatch(nirsSes, path) || conditionalMatch(eegSes, path) || conditionalMatch(ieegSes, path) ) @@ -198,6 +204,10 @@ export default { return conditionalMatch(megData, path) }, + isNIRS: function(path) { + return conditionalMatch(nirsData, path) + }, + isEEG: function(path) { return conditionalMatch(eegData, path) }, @@ -226,6 +236,7 @@ export default { this.isFieldMapMainNii(path) || this.isFunc(path) || this.isMeg(path) || + this.isNIRS(path) || this.isEEG(path) || this.isIEEG(path) || this.isBehavioral(path) ||