Skip to content

Commit

Permalink
Add NIRS support to BIDS
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-luke committed May 8, 2020
1 parent 1888b87 commit b1716a1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 1 deletion.
18 changes: 18 additions & 0 deletions bids-validator/bids_validator/rules/file_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
}
14 changes: 14 additions & 0 deletions bids-validator/bids_validator/rules/session_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
}
12 changes: 12 additions & 0 deletions bids-validator/bids_validator/rules/top_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -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$"
},
Expand Down
6 changes: 5 additions & 1 deletion bids-validator/utils/modalities.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export default {
isCorrectModality = true
break
case 'ieeg':
// iEEG
// EEG
isCorrectModality = true
break
case 'nirs':
// NIRS
isCorrectModality = true
break
default:
Expand Down
11 changes: 11 additions & 0 deletions bids-validator/utils/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 {
/**
Expand All @@ -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) ||
Expand All @@ -99,6 +103,7 @@ export default {
multiDirFieldmap.test(path) ||
otherTopFiles.test(path) ||
megTop.test(path) ||
nirsTop.test(path) ||
eegTop.test(path) ||
ieegTop.test(path)
)
Expand Down Expand Up @@ -147,6 +152,7 @@ export default {
conditionalMatch(anatSes, path) ||
conditionalMatch(dwiSes, path) ||
conditionalMatch(megSes, path) ||
conditionalMatch(nirsSes, path) ||
conditionalMatch(eegSes, path) ||
conditionalMatch(ieegSes, path)
)
Expand Down Expand Up @@ -198,6 +204,10 @@ export default {
return conditionalMatch(megData, path)
},

isNIRS: function(path) {
return conditionalMatch(nirsData, path)
},

isEEG: function(path) {
return conditionalMatch(eegData, path)
},
Expand Down Expand Up @@ -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) ||
Expand Down

0 comments on commit b1716a1

Please sign in to comment.